RFR: 8299058: AssertionError in sun.net.httpserver.ServerImpl when connection is idle

Daniel Jeliński djelinski at openjdk.org
Fri Oct 27 16:54:50 UTC 2023


This patch fixes a race between the selector thread and the IdleTimeoutTask which closes connections that were idle for longer than IDLE_INTERVAL. With this patch, only the thread that successfully removes the connection from idleConnections is permitted to change it. If any data arrives after the IdleTimeoutTask removes the connection from idleConnections, the data is ignored.

Additionally, this patch reduces the time interval between when the IdleTimeoutTask removes the connection from idleConnections and when the connection is closed, back to pre-JDK-8286918 level.

No new test; with platform sockets it's next to impossible to reliably get the timing right. Existing tier1-3 tests pass.

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

Commit messages:
 - Check if connection is still idle before closing
 - Do not handle incoming requests on connections are being closing

Changes: https://git.openjdk.org/jdk/pull/16366/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16366&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8299058
  Stats: 35 lines in 1 file changed: 8 ins; 13 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/16366.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16366/head:pull/16366

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


More information about the net-dev mailing list