[ http://issues.apache.org/jira/browse/DERBY-1817?page=all ]

Knut Anders Hatlen updated DERBY-1817:
--------------------------------------

    Attachment: 1817.diff
                1817.stat

Attaching a patch for this bug. Instead of always putting new sessions in the 
run queue when there are free threads, the network server now compares the 
number of free threads and the size of the run queue. This is done to prevent 
the run queue from growing to a size greater than the number of free threads. 
Also, the server now synchronizes on runQueue until the session has been added 
to the queue. This is to prevent two threads from deciding that there are 
enough free threads and adding the session to the run queue, when there in fact 
only were enough free threads for one of them. With this patch, I am not able 
to reproduce DERBY-1757 on platforms where the failure was easily reproduced 
before.

The patch passes derbyall (Sun JVM 1.4.2, FreeBSD) and is ready for review. 
Thanks!

> Race condition in network server's thread pool
> ----------------------------------------------
>
>                 Key: DERBY-1817
>                 URL: http://issues.apache.org/jira/browse/DERBY-1817
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.2.1.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>         Attachments: 1817.diff, 1817.stat
>
>
> If there is a free DRDAConnThread when a client connects to the network 
> server, the session is put into a queue from which one of the free 
> DRDAConnThreads can pick it up. However, if another client connects after the 
> session was put into the queue, but before the DRDAConnThread has picked it 
> up, one might end up with more sessions in the queue than there are free 
> threads. This can lead to hangs like the ones that we currently see in many 
> of Ole's tests (for instance checkDataSource - 
> http://www.multinet.no/~solberg/public/Apache/TinderBox_Derby/testlog/SunOS-5.10_i86pc-i386/440518-derbyall_diff.txt).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to