On Tue, 7 Feb 2023 14:22:10 GMT, Daniel Fuchs <[email protected]> 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.

Also please don't use `Boolean` but `boolean`

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

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

Reply via email to