RFR: 8300268 : ServerImpl allows too many idle connections when using sun.net.httpserver.maxIdleConnections [v2]

Darragh Clarke duke at openjdk.org
Tue Feb 7 15:00:57 UTC 2023


On Tue, 7 Feb 2023 14:51:01 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>>> New connections created in this way should probably not cause idle connections (which have finished their work) to be closed, and that's possibly what is being observed here.
>> 
>> If I'm understanding correctly, the new connection would be closed instead of the existing idle connection if the idle connection limit has been reached
>
> That's what I'm worried about - but I haven't analyzed the code deeply - just working from memory.

The dispatcher has a comment about this actually, note the last sentence

   *  - NEWLY_ACCEPTED: A connection is marked as newly accepted as soon as the Dispatcher
     *    accept()s a connection. A newly accepted connection is added to a newlyAcceptedConnections
     *    collection. A newly accepted connection also gets added to the allConnections collection.
     *    The newlyAcceptedConnections isn't checked for any size limits, however, if the server is
     *    configured with a maximum connection limit, then the elements in the
     *    newlyAcceptedConnections will never exceed that configured limit (no explicit size checks
     *    are done on the newlyAcceptedConnections collection, since the maximum connection limit
     *    applies to connections across different connection states). A connection in NEWLY_ACCEPTED
     *    state is considered idle and is eligible for idle connection management.

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

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


More information about the net-dev mailing list