[jdk17u-dev] RFR: 8316580: HttpClient with StructuredTaskScope does not close when a task fails [v2]

Goetz Lindenmaier goetz at openjdk.org
Thu Jul 10 14:05:41 UTC 2025


On Tue, 8 Jul 2025 15:40:00 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:

>> 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 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().
>> Finally I removed the "useReferenceTracker=false" test variant, as the
>> HttpClient implementation is quite far off of the implementation in 21.
>
> Goetz Lindenmaier has updated the pull request incrementally with one additional commit since the last revision:
> 
>   more graceful close() implementation

I pushed an extra change to the test. 
It replaces the shutdownNow() by more graceful coding. 
This seems to better imitate the behavior of the original test.
Unfortunately with this change the test hangs until it is killed by jtreg.
It only passes if run with the debug build, and once passed in our nightlies with the fastdebug.
I copied the modified test into my jdk21 repo where it passes as expected.

-------------

PR Comment: https://git.openjdk.org/jdk17u-dev/pull/3706#issuecomment-3057597377


More information about the jdk-updates-dev mailing list