RFR: 8347597: HttpClient: improve exception reporting when closing connection [v2]

Jaikiran Pai jpai at openjdk.org
Wed Jan 15 01:21:42 UTC 2025


On Tue, 14 Jan 2025 20:29:38 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> There are a few places in the HttpClient code base where we close the connection when some error/exception happens. This can some time trigger a race condition where closing the connection in turns causes a "connection closed locally" exception to get reported instead of the original exception. This typically happens if another thread is attempting to read from / write to the connection concurrently when the original exception that caused the connection to get closed occurred. 
>> 
>> The fix makes sure that we store the first exception in the underlying connection before closing it, and that this is the exception that gets subsequently reported.
>> 
>> Some minor drive by test fixes. No new regression test.
>
> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review feedback from @japai

Thank you for the update. This looks good to me.

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

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23080#pullrequestreview-2551376703


More information about the net-dev mailing list