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

Jaikiran Pai jpai at openjdk.org
Tue Oct 31 06:01:32 UTC 2023


On Mon, 30 Oct 2023 09:04:11 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 531:
>> 
>>> 529:                                         // has now started on this connection.
>>> 530:                                         requestStarted(conn);
>>> 531:                                         handle (chan, conn);
>> 
>> In its current proposed form, if the connection wasn't in the newlyAcceptedConnections or idleConnections set, we don't seem to do anything (and expect the connection to be closed in a concurrent thread). Perhaps we should move this if block a few lines above and only cancel the key and put the channel in blocking mode, if this `if` condition satisfies?
>
> It's complicated, and perhaps deserves a separate fix.
> If the connection is plain HTTP, it doesn't matter; we close the connection, and this succeeds regardless if the connection is blocking or not.
> If the connection is HTTPS, we send an alert to the peer using this code:
> https://github.com/openjdk/jdk/blob/3934127b087ade1c1286008df3497ca6d84778a5/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java#L294-L296
> And here again the blocking vs. non-blocking mode doesn't matter: if there's room in the send buffer, the send will succeed immediately, and if there's no room, it will block.

Hello Daniel,

> It's complicated, and perhaps deserves a separate fix.

That's OK with me. The current state of this PR then looks fine to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16366#discussion_r1377088659


More information about the net-dev mailing list