Hi, I am investigating an issue where Sun Application server hangs "temporarily"/"permanently" while talking to Derby Server.
I could not reproduce the temporary hang. However I could make the hang permanent. Permanent Hang Steps : derby.properties will have the following settings: derby.drda.maxThreads=32 derby.drda.timeslice=2000 In appserver connection-pool, steady-pool-size is 34 (when the pool is initialized 34 connections will be created). When the pool is being initialized, derby.log prints that 31 or 32 or 33 connections had been created and appserver is trying to make another connection. Appserver hangs waiting for the response from derby. JStack output below : ------------------------------------------------------------------------------------------------ Thread 9782: (state = IN_NATIVE) - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Interpreted frame) - java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 (Interpreted frame) - org.apache.derby.client.net.Reply.fill(int) @bci=34 (Interpreted frame) - org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(int) @bci=21 (Interpreted frame) - org.apache.derby.client.net.Reply.readDssHeader() @bci=7 (Interpreted frame) - org.apache.derby.client.net.Reply.startSameIdChainParse() @bci=1 (Interpreted frame) - org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(org.apache.derby.client.am.Connection) @bci=1 (Interpreted frame) - org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(int) @bci=8 (Interpreted frame) - org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(int, byte[]) @bci=22 (Interpreted frame) - org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(java.lang.String) @bci=3 (Interpreted frame) - org.apache.derby.client.net.NetConnection.flowConnect(java.lang.String, int) @bci=163 (Interpreted frame) - org.apache.derby.client.net.NetConnection.initialize(java.lang.String, java.lang.String, org.apache.derby.jdbc.ClientDataSource, int, boolean) @bci=40 (Interpreted frame) - org.apache.derby.client.net.NetConnection.<init>(org.apache.derby.client.net.NetLogWriter, java.lang.String, java.lang.String, org.apache.derby.jdbc.ClientDataSource, int, boolean) @bci=135 (Interpreted frame) - org.apache.derby.jdbc.ClientDataSource.getConnection(java.lang.String, java.lang.String) @bci=32 (Interpreted frame) - com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo) @bci=77, line=96 (Interpreted frame) - com.sun.enterprise.resource.LocalTxConnectorAllocator.createResource() @bci=12, line=56 (Interpreted frame) - com.sun.enterprise.resource.AbstractResourcePool.createSingleResource(com.sun.enterprise.resource.ResourceAllocator) @bci=8, line=756 (Interpreted frame) - com.sun.enterprise.resource.AbstractResourcePool.createResourceAndAddToPool(com.sun.enterprise.resource.ResourceAllocator) @bci=2, line=1515 (Interpreted frame) - com.sun.enterprise.resource.AbstractResourcePool.createResources(com.sun.enterprise.resource.ResourceAllocator, int) @bci=9, line=780 (Interpreted frame) - com.sun.enterprise.resource.AbstractResourcePool.initPool(com.sun.enterprise.resource.ResourceSpec, com.sun.enterprise.resource.ResourceAllocator) @bci=27, line=209 (Interpreted frame) - com.sun.enterprise.resource.AbstractResourcePool.internalGetResource(com.sun.enterprise.resource.ResourceSpec, com.sun.enterprise.resource.ResourceAllocator, javax.transaction.Transaction) @bci=10, line=501 (Interpreted frame) - com.sun.enterprise.resource.AbstractResourcePool.getResource(com.sun.enterprise.resource.ResourceSpec, com.sun.enterprise.resource.ResourceAllocator, javax.transaction.Transaction) @bci=37, line=428 (Interpreted frame) - com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(com.sun.enterprise.resource.ResourceSpec, com.sun.enterprise.resource.ResourceAllocator, com.sun.enterprise.resource.ClientSecurityInfo, javax.transaction.Transaction) @bci=16, line=248 (Interpreted frame) - com.sun.enterprise.resource.PoolManagerImpl.getResource(com.sun.enterprise.resource.ResourceSpec, com.sun.enterprise.resource.ResourceAllocator, com.sun.enterprise.resource.ClientSecurityInfo) @bci=34, line=174 (Interpreted frame) - com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(javax.resource.spi.ManagedConnectionFactory, com.sun.enterprise.deployment.ResourcePrincipal, javax.resource.spi.ConnectionRequestInfo, boolean, java.lang.String, java.lang.Object, boolean) @bci=388, line=312 (Interpreted frame) - com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ConnectionRequestInfo, java.lang.String, java.lang.Object) @bci=362, line=222 (Interpreted frame) - com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ConnectionRequestInfo, java.lang.String) @bci=5, line=152 (Interpreted frame) - com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ConnectionRequestInfo) @bci=7, line=145 (Interpreted frame) - com.sun.gjc.spi.base.DataSource.getConnection() @bci=9, line=95 (Interpreted frame) ------------------------------------------------------------------------------------------------ 1) Can someone please clarify the "maxthreads" & "timeslice" property ? 2) The above said hang seems to be permanent. Is this expected behavior ? 3) Is it possible that when derby server has lesser threads (32) and many requests ( > 32 ), derby will respond slowly i.e., user can explicitly see that the request is waiting for sometime (30 secs, for ex) and then get the response ? Thanks, -Jagadish
