1 Reply Latest reply on Dec 22, 2005 11:21 AM by sumitsu

    EJB Database Access stall

    sumitsu

      I recently completed transitioning an RMI standalone application (which operated via naming lookup on rmiregistry) to EJBs running under JBoss 4.0.3. The application makes JDBC calls to a database in order to get user/login information.

      The problem is that, at seemingly random intervals, requests from the JDBC connection class running on JBoss to the database suddenly start to hang forever, and, in nearly every case, no Java exception is produced in server.log or on the terminal output. The EJBs continue to accept JDNI requests from the associated web application as normal (as evidenced by debug statements), but once the behavior starts, database calls fail to return, producing no error output at all (as far as I can tell), until the JBoss server is restarted and the EJBs reloaded.

      I believe I have isolated the stall to the following log4j call (as it is the first in the sequence of logger calls in the database-access sequence not to produce log output):

      log.debug("About to get a connection (active count=" +
      ((oracle.jdbc.pool.OracleConnectionCacheImpl)dataSource).getActiveSize() + ",curr-cache=" +
      ((oracle.jdbc.pool.OracleConnectionCacheImpl)dataSource).getCacheSize()+")");
      


      The reason that I think this to be a JBoss-related problem is that restarting the JBoss server does correct the problem temporarily, and that the older RMI-registry implementation never had such an issue, despite using exactly the same JDBC code. It has been maddening trying to resolve the problem, as it is essentially impossible to reproduce it on command. Increased usage does seem to be some sort of factor, as the problem occurs more frequently during periods of heavy load (every few hours, as opposed to every few days), but I have yet to successfully induce the malfunction by artificially loading the application with requests. Trying to solve this via trial-and-error would therefore be an extremely slow process.

      Has anyone else had a similar problem with getActiveSize() or getCacheSize() calls blocking indefinitely, or with database calls eminating from JBoss-deployed EJBs randomly starting to stall out?

      Thanks,

      Branden Smith
      bsmith@liaison.com

        • 1. Re: EJB Database Access stall
          sumitsu

          One additional piece of information: sometimes, the stalled request eventually fails and produces this exception:

          java.sql.SQLException: Closed Connection
           at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
           at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
           at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
           at oracle.jdbc.pool.OraclePooledConnection.getConnection(OraclePooledConnection.java:189)
           at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:251)
           at oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCacheImpl.java:163)
          
          ... (continues)
          
          


          It's a fairly long stack trace, but the next line down is from the database connection class constructor from my code.

          Any ideas?