3 Replies Latest reply on Oct 15, 2001 12:29 AM by David Jencks

    Communication link failure

    Anders Steinlein Newbie

      After my Linux box running JBoss 2.4.0 with Tomcat 2.3.2 has been standing "idle" over night, I seem to get a SocketException when it tries to access the database (MySQL) next morning. The first part of the huge console output reads:

      [AccountEJB] TRANSACTION ROLLBACK EXCEPTION:SQLException while checking for an existing user. Parameter = Password, value = 4cto8iknp5: Communication link failure: java.net.SocketException; nested exception is:
      javax.ejb.EJBException: SQLException while checking for an existing user. Parameter = Password, value = 4cto8iknp5: Communication link failure: java.net.SocketException
      [AccountEJB] javax.ejb.EJBException: SQLException while checking for an existing user. Parameter = Password, value = 4cto8iknp5: Communication link failure: java.net.SocketException
      [...]

      Further down the exception trace is something which makes me think there is something strange happening in the connection pool:

      [...]
      [GameClientControllerEJB] XAException: tx=XidImpl [FormatId=257, GlobalId=vectra.localnet//18, BranchQual=] errorCode=XA_UNKNOWN(0)
      [GameClientControllerEJB] javax.transaction.xa.XAException: Rollback failed: Communication link failure: java.io.IOException
      [GameClientControllerEJB] at org.jboss.pool.jdbc.xa.wrapper.XAResourceImpl.rollback(XAResourceImpl.java:219)
      [...]

      The application seems to work great when it's accessed often enough, but after a long time in idle state, I get this error at the time of the first database access.

      All hints to help me solve this problem would be greatly appreciated! Thanks,
      \Anders

        • 1. Re: Communication link failure
          David Jencks Master

          A lot of dbs /drivers kill their connections after a period of inactivity.

          You need to set some pool parameters to take care of this... I made it a little easier in 3.0

          As I recall(from memory)in 2.4 you set
          idle timeout maybe 1/2 the time before the db kills the connection
          idletimeout enabled true
          GCEnabled true
          you probably need a GCinterval too, but set it high.


          "GCEnabled" is misleading: it needs to be true or idle timeout stuff is ignored. Hopefully this is all you need.

          • 2. Re: Communication link failure
            Anders Steinlein Newbie

            Thanks a lot for your reply.

            Just after I made my initial post I checked the wait_timeout variable in MySQL - the time it takes before idle connections are terminated. This variable was set to 8 hours. Maybe it could help to just increase that one? I set it to 12 hours anyways... By:

            > idle timeout maybe 1/2 the time before the db kills the connection

            You mean about 1/2 of 12 hours then? As that is what I set the MySQL wait_timeout value to? And one last thing:

            > you probably need a GCinterval too, but set it high.

            Default is 2 minutes, what is considered "high"? 30 minutes?

            Thanks yet again! Regards,
            \Anders

            • 3. Re: Communication link failure
              David Jencks Master

              Thinking a bit more... I think you just need idle timeout + gc interval slightly less than db idle timeout. GC is kind of useless, shouldn't be used IMHO in j2ee apps, so you might as well set them both to say 45% of the db timeout.