db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1326) Network server may abandon sessions when Derby system is shutdown and this causes intermittent hangs in the client
Date Fri, 26 May 2006 15:46:31 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1326?page=comments#action_12413488 ] 

Bryan Pendleton commented on DERBY-1326:

Hi Deepa, thanks very much for looking at the patch!

The new message that you see is definitely  a result of this patch; I see it as well, 
and should have mentioned it when I attached the patch. 

I believe that the new symptom is a result of the code I added to DRDAConnThread's
run() method, to try to handle the case when a thread returns from getNextSession() to
find itself in the interesting situation of having been given a Session to run, but also having
been closed():

                if (closed())
+        {
+            // FIXME -- I think that if we return from
+            // getNextSession() with a non-null Session, but
+            // we ourselves have been closed(), this indicates
+            // a bug in the Network Server session management,
+            // as it shouldn't have assigned a valid session
+            // to a closed thread. Closing the session here
+            // is rude, but at least it prevents a hard hang. (DERBY-1326)
+            try {
+                if (session != null)
+                    session.close();
+            }catch (Exception e) { e.printStackTrace(); }
+        }

It's clear that this code is wrong, as evidenced by the symptoms you see.

Note also that in my code I didn't know what to do if I hit an exception; this is
very closely related to bug DERBY-1020 (thanks Kathey for pointing this out).

The question I have is (and this is the main question left in this bug, I think):

  what should the DRDAConnThread do in this situation?

The possibilities I've thought of include:
 - ignore that fact that we've been closed; re-open ourselves and handle
   the Session we've been given
 - give the Session back to the NetworkServerControlImpl and ask it to
   assign a different thread to this task
 - hard-close the Session, then exit the thread. This was the solution I tried,
   and as you can see it has some awkard side-effects.

Either of the first two seems like it might be a reasonable approach in the
case where the Network Server was restarted, not shut down, but they both
seem wrong in the case where the Network Server was shut down; in that
case it seems that the Session is doomed and we should just pack our
bags and leave quietly.

Please let me know what you think about how best to handle this case.

> 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
> 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:
For more information on JIRA, see:

View raw message