1 Reply Latest reply on Feb 5, 2012 3:19 PM by wdfink

    I found a bug in JBoss JDBC WrappedConnection

    hatterjiang

      I'm a chinese user of JBoss 4.0.5GA.

       

      We use JBoss JDBC connection pool connect to MySQL database, and we use MySQL proxy, before the MySQL proxy we use F5 as load balancer, as the attachment shows.

       

      In normal status, client use F5(Master) connection to the MySQL proxy, but some times F5(Master) will switch to Slave, and the long time connection will be abandon.

      Then we found, some times the JBoss JDBC connection pool cannot automatic recovery from this erorr, some times can.

      After debug, we found these code:

       

         public PreparedStatement prepareStatement(String sql) throws SQLException

       

         {

            checkTransaction();

            try

            {

               return new WrappedPreparedStatement(this, mc.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));

            }

            catch (Throwable t)

            {

               throw checkException(t);

            }

         }

      We find when "checkTransaction();" cause Exception, MySQL JDBC connection will be mark as closed, but JBoss JDBC WrappedConnection wont mark it as closed, so this connection is aways in the connection pool, but cannot execute any SQL, because the real status of the connection is closed.

       

      We replace "checkTransaction();" into the try block, and redo the test, it seems OK.

       

      I also view the latest 7.0.1 CR1b version of JBoss, this problem is not resolved.