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

Daniel Fuchs dfuchs at openjdk.org
Tue Jan 14 20:29:38 UTC 2025


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23080/files
  - new: https://git.openjdk.org/jdk/pull/23080/files/0be4389d..ff98d876

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23080&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23080&range=00-01

  Stats: 41 lines in 3 files changed: 33 ins; 2 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/23080.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23080/head:pull/23080

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


More information about the net-dev mailing list