[ 
http://issues.apache.org/jira/browse/DERBY-1326?page=comments#action_12414497 ] 

Bryan Pendleton commented on DERBY-1326:
----------------------------------------

Hi Deepa, thank you for the excellent analysis. It is very helpful.

The only part that troubles me is this:

> The interrupt calls and the added synchronization assure that freeThreads 
> will 
> become 0 before we start accepting new sessions

I am not yet able to see why that is necessarily true.

I agree that we issue the interrupt() calls prior to completing the restart and 
prior
to accepting new sessions.

However, the thread which is interrupted responds to this interrupt 
asynchronously.

I believe that the only guarantee made by Java is that the thread which we are 
interrupting
will receive that interrupt some time in the future, but not necessarily 
immediately,
and not necessarily before we reach the end of the startNetworkServer() method
and declare the restart complete.

In practice, given that the startNetworkServer() method is going to unload the 
embedded engine, call System.gc(), and then reload the embedded engine,
that's probably enough work so that we have a very good chance that all the
old threads have received and responded to their interrupt() before we complete.

But I don't think it's actually *guaranteed* by the current changes in the 
combined patch.

I may be being too picky here. What do you think?


> Network server may abandon sessions when Derby system is shutdown and this 
> causes intermittent hangs in the client
> ------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-1326
>          URL: http://issues.apache.org/jira/browse/DERBY-1326
>      Project: Derby
>         Type: Bug

>   Components: Network Server
>     Reporter: Deepa Remesh
>     Assignee: Bryan Pendleton
>  Attachments: repro1326.java, sessionMgmt1.diff, 
> sessionMgmt1_and_nosessionsforclosedthreads.diff
>
> This issue was found when working on DERBY-1219. More details can be found in 
> the comments at http://issues.apache.org/jira/browse/DERBY-1219

-- 
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