Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8311792: java/net/httpclient/ResponsePublisher.java fails intermittently with AssertionError: Found some outstanding operations #15307

Closed
wants to merge 2 commits into from

Conversation

DarraghClarke
Copy link
Contributor

@DarraghClarke DarraghClarke commented Aug 16, 2023

Currently ResponsePublisher occasionally fails due to unreleased resources.
Updated test based on AbstractThrowingPushPromises to ensure that non-shared clients get closed before further iterations run, this should limit the max number of clients that remain alive during the test.

I ran tiers 1-3 and everything is passing


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8311792: java/net/httpclient/ResponsePublisher.java fails intermittently with AssertionError: Found some outstanding operations (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15307/head:pull/15307
$ git checkout pull/15307

Update a local copy of the PR:
$ git checkout pull/15307
$ git pull https://git.openjdk.org/jdk.git pull/15307/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15307

View PR using the GUI difftool:
$ git pr show -t 15307

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15307.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 16, 2023

👋 Welcome back dclarke! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 16, 2023
@openjdk
Copy link

openjdk bot commented Aug 16, 2023

@DarraghClarke The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Aug 16, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 16, 2023

Webrevs

System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Darragh, 10 seconds looks a bit too large, even if it's the max time to wait. Before this change the graceDelayms was 500 milli seconds. So this appears to be a big jump. Perhaps we should start with something like 2 or 5 seconds (an arbitrary number, I admit)?

Copy link
Member

@dfuch dfuch Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't take 10 seconds for the client to shutdown, so it shouldn't matter that we use a large timeout. I we used HttpClient::close() we would wait forever (that is - we would wait for as long as it takes).
I believe 500ms to wait for the GC to kick in was a bit optimistic for cases where the machine is overloaded by other tasks. Waiting for a client to be gc'ed or closed until we create the next one should help, as it will ensure there are no lingering resources waiting to be released.
The advantage of using close() is that it is much cleaner and simpler. The disadvantage is that if it fails in timeout there, you have no clue about what prevented close() to finish. In opposition the tracker will provide diagnosis if the client fails to close in the imparted delay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The advantage of using close() is that it is much cleaner and simpler. The disadvantage is that if it fails in timeout there, you have no clue about what prevented close() to finish. In opposition the tracker will provide diagnosis if the client fails to close in the imparted delay.

That sounds reasonable to me. The changes look fine in this PR.

// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment and the decision to not use HttpClient.close() in this test relevant to this test case? In AbstractThrowingPublishers, which is where this comment initially resided like you note in the PR description, I think it was relevant. I haven't thoroughly looked at the tests in this ResponsePublisher test, so unsure if we can't/shouldn't use HttpClient.close() in these test methods.

System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
Copy link
Member

@dfuch dfuch Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't take 10 seconds for the client to shutdown, so it shouldn't matter that we use a large timeout. I we used HttpClient::close() we would wait forever (that is - we would wait for as long as it takes).
I believe 500ms to wait for the GC to kick in was a bit optimistic for cases where the machine is overloaded by other tasks. Waiting for a client to be gc'ed or closed until we create the next one should help, as it will ensure there are no lingering resources waiting to be released.
The advantage of using close() is that it is much cleaner and simpler. The disadvantage is that if it fails in timeout there, you have no clue about what prevented close() to finish. In opposition the tracker will provide diagnosis if the client fails to close in the imparted delay.

test/jdk/java/net/httpclient/ResponsePublisher.java Outdated Show resolved Hide resolved
Co-authored-by: Daniel Fuchs <67001856+dfuch@users.noreply.github.com>
Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please make sure the changed test passes reliably in the CI before integrating.

@openjdk
Copy link

openjdk bot commented Aug 24, 2023

@DarraghClarke This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8311792: java/net/httpclient/ResponsePublisher.java fails intermittently with AssertionError: Found some outstanding operations

Reviewed-by: dfuchs, jpai

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 174 new commits pushed to the master branch:

  • 97b94cb: 8314883: Java_java_util_prefs_FileSystemPreferences_lockFile0 write result errno in missing case
  • 75e19e0: 8314819: [JVMCI] HotSpotJVMCIRuntime.lookupType throws unexpected ClassNotFoundException
  • c418933: 8313530: VM build without C2 fails after JDK-8312579
  • de0e46c: 8303815: Improve Metaspace test speed
  • 3699666: 8313319: [linux] mmap should use MAP_FIXED_NOREPLACE if available
  • 3285a1e: 8314555: Build with mawk fails on Windows
  • 4a50e87: 8303852: current_stack_region() gets called twice unnecessarily
  • c077be4: 8314694: Separate checked_cast from globalDefinitions.hpp
  • 68815d5: 8314734: Remove unused field TypeVariableImpl.EMPTY_ANNOTATION_ARRAY
  • 57a322d: 8308042: [macos] Developer ID Application Certificate not picked up by jpackage if it contains UNICODE characters
  • ... and 164 more: https://git.openjdk.org/jdk/compare/360f65d7b15b327e2f160c42f318945cc6548bda...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 24, 2023
@DarraghClarke
Copy link
Contributor Author

I reran the tests and everything is passing

@DarraghClarke
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 28, 2023

Going to push as commit 1664e79.
Since your change was applied there have been 197 commits pushed to the master branch:

  • 0901d75: 8314762: Make {@Incubating} conventional
  • 12de9b0: 8314148: Fix variable scope in SunMSCAPI
  • 7fbad4c: 8310596: Utilize existing method frame::interpreter_frame_monitor_size_in_bytes()
  • 752a438: 8314684: Add overview docs to loaderConstraints.cpp
  • acd9310: 8313430: [JVMCI] fatal error: Never compilable: in JVMCI shutdown
  • 8a5db6b: 8237542: JMapHeapConfigTest.java doesn't work with negative jlong values
  • d0cc043: 8314550: [macosx-aarch64] serviceability/sa/TestJmapCore.java fails with "sun.jvm.hotspot.debugger.UnmappedAddressException: 801000800"
  • 837d2e1: 8314483: Optionally override copyright header in generated source
  • 3201623: 8310454: Introduce static-libs-graal bundle
  • e9ba8d5: 8314960: Add Certigna Root CA - 2
  • ... and 187 more: https://git.openjdk.org/jdk/compare/360f65d7b15b327e2f160c42f318945cc6548bda...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 28, 2023
@openjdk openjdk bot closed this Aug 28, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Aug 28, 2023
@openjdk
Copy link

openjdk bot commented Aug 28, 2023

@DarraghClarke Pushed as commit 1664e79.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
3 participants