RFR: 8300268 : ServerImpl allows too many idle connections when using sun.net.httpserver.maxIdleConnections
Daniel Fuchs
dfuchs at openjdk.org
Tue Feb 7 14:25:48 UTC 2023
On Fri, 3 Feb 2023 17:58:28 GMT, Darragh Clarke <duke at openjdk.org> wrote:
> Currently there is a race condition that can allow for too many 'idleConnections' in `ServerImpl`
>
> This PR adds a lock to make sure only one connection can be marked Idle at a time as well as a test that consistently failed before the change but which now passes.
src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 966:
> 964:
> 965: void markIdle(HttpConnection c) {
> 966: Boolean close = false;
IIRC a connection can be marked idle temporarily if we don't receive data just right after accepting the connection. 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 it is then I'd have to agree that the fix is probably not in the right place - or that we may need to revisit how we handled 'new' connections that have never been used.
-------------
PR: https://git.openjdk.org/jdk/pull/12413
More information about the net-dev
mailing list