Integrated: 8347597: HttpClient: improve exception reporting when closing connection

Daniel Fuchs dfuchs at openjdk.org
Wed Jan 15 12:43:46 UTC 2025


On Mon, 13 Jan 2025 16:07:45 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.

This pull request has now been integrated.

Changeset: 7df21a8f
Author:    Daniel Fuchs <dfuchs at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/7df21a8f09ab606f38a44d84d841d4bba9f09adf
Stats:     254 lines in 16 files changed: 128 ins; 37 del; 89 mod

8347597: HttpClient: improve exception reporting when closing connection

Reviewed-by: jpai

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

PR: https://git.openjdk.org/jdk/pull/23080


More information about the net-dev mailing list