db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (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 Wed, 13 Sep 2006 10:14:23 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1326?page=comments#action_12434398 ] 
            
Knut Anders Hatlen commented on DERBY-1326:
-------------------------------------------

Francois wrote:

> Were you actually implying some auto database reconnect of the
> current DRDA threads created in the network server once the Derby
> engine or/and databases are brought back up?

Yes, when the server detects that one of the clients has shut down the
engine (it checks the SQLSTATE of exceptions before sending them to
the client), it (a) closes all sessions that are in the run queue
waiting for a thread, (b) poisons all DRDAConnThreads, and (c) reboots
the engine. Because the poisoned DRDAConnThreads are left around, they
will eventually pick up a session but abandon it.

Bryan wrote:

> Deepa and I discussed this a fair amount in DERBY-1219; you should
> probably review that discussion to see if there's more you can learn
> from it.  In particular, the discussion regarding "skipThreads.diff"
> at: http://issues.apache.org/jira/browse/DERBY-1219#action_12378300

There are many interesting patches attached to that issue (though I am
definitely not going for any solution which involves
Thread.interrupt()). skipThreads.diff seems to do exactly what I
proposed. From the comments, it seems like there were two objections:

  1) It didn't fix all of the hangs.
  2) Removing the cleanup code didn't feel quite right, but if the
     threads could be reused after a restart, it should be okay.

The hangs mentioned in (1) could be the same ones as DERBY-1817
fixed. I also believe that the threads can be reused after a restart.

> If we didn't close down the threads, would we do anything to notify
> them of the shutdown? Were you proposing to leave them alone
> entirely? Or were you proposing to notify them of the shutdown, but
> not require the threads to exit?

I don't think we need to notify them about the shutdown. If a thread
is waiting for runQueue notification in getNextSession(), it is not
bound to a session and hence doesn't need to know about the
shutdown. If a thread has a session bound to it, it would stay
sleeping (and unavailable for new sessions) until the client closes
the connection or disconnects. This is quite similar to the current
behaviour (the closed threads are not freed until there is some
activity on them).

For the latter (threads with sessions), it would make sense to notify
them about the shutdown so they could drop their invalid sessions
earlier, but that would be an optimization and not a correctness
issue, I think.

> Are you sure a DRDAConnThread doesn't have dependencies on the
> engine instance? The thread has a pointer to a session, and a
> session seems like it could point to database objects (like
> Connection objects, e.g.)

All DRDAConnThread's dependencies on the engine go through the session
pointer. For free threads, the session pointer is null, hence there
are no dependencies. If it picks up a new session, it would depend on
the new session's engine, not the old one.

For active DRDAConnThread instances, there are dependencies on the old
engine after the shutdown. However, this is also the case for the
current code (the thread is marked as closed, but the session is not
abandoned and the thread is not stopped until the client tries to
perform an operation on the connection).

> 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
>          Issue Type: Bug
>          Components: Network Server
>            Reporter: Deepa Remesh
>         Assigned To: Knut Anders Hatlen
>         Attachments: repro1326.java, resolve_DRDConnThread_conflict.diff, Restart.java,
sessionMgmt1.diff, sessionMgmt1_and_nosessionsforclosedthreads.diff, unify_NSImpl_instances.diff,
withNewThreadAndNoShutdownOfCurrentSession.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

        

Mime
View raw message