-
Notifications
You must be signed in to change notification settings - Fork 225
8316580: HttpClient with StructuredTaskScope does not close when a task fails #3706
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back goetz! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
GHA failure: unrelated. |
|
I pushed an extra change to the test. |
Hi @dfuch, @wxiao @djelinski |
Hi @GoeLin, that's a different problem here; looking at the thread dump in the jtr file, you can see that the ForkJoinPool tasks are still running. Apparently |
Hi @djelinski, thanks for the help. We are now calling shutdownNow() in TestTaskScope.close(). The test results now look similar to 21. |
Hi @alexeybakhtin, you did the open backport to 21 for this change. Could you please have a look at this backport and do a second review please? Thanks! |
I backport this for parity with 17.0.17-oracle.
The change applies clean, but the test does not work out-of-the-box.
It calls some utility methods from ReferenceTracker.java that were added by JDK-8305847.
That change is not in the current list of backports, so I added the utility methods
to this change.
Further, the test depends on the fact that in 21 a row of classes implement
AutoClosable, which they don't do in 21.
I adapted a row of places to work around this.
A try-with-resources statement was easy to replace, as the missing
close() implementation uses public methods, so that I could copy the
code to the test.
In TestTaskScope I replaced close() by shutdownNow(). Update: after some
research this was further adapted.
Finally I removed the "useReferenceTracker=false" test variant, as the
HttpClient implementation is quite far off of the implementation in 21,
so that the close() method implemented in 21 for Autoclosable can not
be easily simulated in the test.
Original test compile error:
test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java:239: error: cannot find symbol
pool.close();
^
symbol: method close()
location: variable pool of type ExecutorService
test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java:249: error: incompatible types: try-with-resources not applicable to variable type
try (final var executor = testExecutor()) {
^
(ExecutorService cannot be converted to AutoCloseable)
test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java:277: error: incompatible types: Tracker cannot be converted to StringBuilder
System.out.println(TRACKER.diagnose(tracker));
^
test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java:293: error: cannot find symbol
httpClient.close();
^
symbol: method close()
location: variable httpClient of type HttpClient
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/3706/head:pull/3706
$ git checkout pull/3706
Update a local copy of the PR:
$ git checkout pull/3706
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/3706/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3706
View PR using the GUI difftool:
$ git pr show -t 3706
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/3706.diff
Using Webrev
Link to Webrev Comment