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 Thu, 08 Jun 2006 05:06:31 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1326?page=comments#action_12415277 ] 

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

Well this is very interesting! There is always something new to learn :)

The test program intends to do the following:
 - start up the Network Server
 - check that it started successfully
 - shut it down
 - start it up with a slightly different configuration
 - check that it started successfully
 - shut it down

So we think we are starting it up twice and shutting it down twice

When I investigated the hang that Deepa discovered, however, I learned that
in fact we are starting up the Network Server *four* times, and shutting it down
twice. These extra Network Server instances didn't harm anything in the past,
because it was just a waste of memory to start up the extra instances.

However, when I added the new thread creation code in the network server
startup, it meant that whenever the network server started, a DRDAConnThread
was also started. And if that network server wasn't shut down, then the
DRDAConnThread instance remained, and prevented the server from shutting
down, causing the hang.

The reason that we are getting the extra NetworkServerControlImpl instances is very
simple: when you call NetworkServerControlImpl.start, it does the following:

public void start(PrintWriter consoleWriter)
    throws Exception
{
    DRDAServerStarter starter = new DRDAServerStarter();
    starter.setStartInfo(hostAddress,portNumber,consoleWriter);
    startNetworkServer(null);
    starter.boot(false,null);
}

That is, it directly starts this instance, then it spawns a background thread to
run the DRDAServerStarter code, which instantiates *another* NetworkServerControlImpl

My first idea was to remove the call to startNetworkServer() from this method, and just
let DRDAServerStarter start up the Network Server.

Sure enough, this fixes the hang in DerbyNetNewServer.

And, conceptually, it seems like a good change to make, because it doesn't seem
like we should be starting the Network Server twice.

However, removing the call to startNetworkServer causes test failures in a bunch of
other Network Server tests, such as NSinSameJVM, dataSourcePermissions_net,
ownServerTests, and testSecMec.

So, there's a bunch more investigation to do here :)

> 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, resolve_DRDConnThread_conflict.diff, sessionMgmt1.diff,
sessionMgmt1_and_nosessionsforclosedthreads.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