6 Replies Latest reply on Oct 3, 2003 8:22 AM by adrian.brock

    Bean hangs when creating two concurrent connections

    stefanfreyr

      Hello. I have the following code which results in a hang situation:

      http://kunder.greit.no/wilco/Pastecode.aspx?pasteID=564

      The line: EJBHelpers.getDatabaseConnection(); refers to a method that retrieves the database connection through JNDI:

      http://kunder.greit.no/wilco/Pastecode.aspx?pasteID=565

      I have an informix datasource defined in an "informix-xa-ds.xml" file in my server/default/deploy dir:

      http://kunder.greit.no/wilco/Pastecode.aspx?pasteID=567

      Can anybody tell me what's going on?

      What happens is that the operation hangs on the second call to the EJBHelpers.getDatabaseConnection() method. If left alone, the following message appears in JBoss;
      [pre]
      WARN [TransactionImpl] Transaction TransactionImpl:XidImpl [FormatId=257, GlobalId=pandora-stfs//35, BranchQual=] timed out. status=STATUS_ACTIVE
      [/pre]
      And I get the following error at the client side:
      [pre]
      java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.io.EOFException
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:203)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:87)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      at $Proxy2.takeFive(Unknown Source)
      at is.althingi.embla.ejbservice.ParliamentSessionClient.main(ParliamentSessionClient.java:78)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
      Caused by: java.io.EOFException
      at java.io.DataInputStream.readByte(DataInputStream.java:333)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:189)
      ... 15 more
      [/pre]

        • 1. Re: Bean hangs when creating two concurrent connections
          stefanfreyr

          I forgot to mention that I'm using JBoss 3.2.1.

          • 2. Re: Bean hangs when creating two concurrent connections

            Show me where it is hanging, post a threaddump.

            Regards,
            Adrian

            • 3. Re: Bean hangs when creating two concurrent connections
              stefanfreyr

              Hello.

              Sorry for the long delay in responding... I didn't realize that Jive wasn't set up by default to email me replies to my threads :o(

              Sorry for being vague in my previous post, the hang is happening in line 21 in the "takeFive" method (the topmost link in my original post), the instant it tries to create the second connection.

              Attached you'll find a thread dump performed during the hang. I hope that's what you wanted. After the thread dump I let it wait until the hang timed out.

              Kind regards, and thanks for your help.

              • 4. Re: Bean hangs when creating two concurrent connections

                It is waiting for a database response.
                Look in your database's logging.

                "RMI TCP Connection(1)-127.0.0.1" daemon prio=1 tid=0x087001c0 nid=0x3eea runnable [bd5fd000..bd5ff8d8]
                at java.net.SocketInputStream.socketRead0(Native Method)
                at java.net.SocketInputStream.read(SocketInputStream.java:129)
                at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                at java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
                at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
                - locked <0x44b310c8> (a java.io.BufferedInputStream)
                at com.informix.asf.IfxDataInputStream.readFully(IfxDataInputStream.java:149)
                at com.informix.asf.IfxDataInputStream.readSmallInt(IfxDataInputStream.java:428)
                at com.informix.jdbcx.IfxXASqli.receiveMessage(IfxXASqli.java:106)
                at com.informix.jdbcx.IfxXASqli.executeXACommand(IfxXASqli.java:268)
                at com.informix.jdbcx.IfxXAResource.start(IfxXAResource.java:456)
                at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:133)
                at org.jboss.tm.TransactionImpl.startResource(TransactionImpl.java:1137)
                at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:617)
                at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:460)
                at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:490)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
                at is.althingi.embla.ejbservice.worker.DBWorker.getDatabaseConnection(DBWorker.java:29)

                Regards,
                Adrian

                • 5. Re: Bean hangs when creating two concurrent connections
                  stefanfreyr

                  Ok, thanks for your help.

                  Any pointers on what we should be looking for? We have Informix 9.x and I'm not quite sure what exactly it is that I should be investigating.

                  There is another thing. It seems that this is only happening when two connections are made from the same computer. There are three of us and we're able to connect to the DB on our computers at the same time but we jus cannot create two connections from the same computer (or at least within a given JBoss instance).

                  Kind regards, Stefan.

                  p.s. why am I still not getting mail notifications from this thread???

                  • 6. Re: Bean hangs when creating two concurrent connections

                    Sounds like an Informix config issue, sorry I don't know anything
                    about it.

                    The watch settings probably only work on a new thread.

                    Regards,
                    Adrian