3 Replies Latest reply on Nov 8, 2010 4:41 PM by Wolf-Dieter Fink

    When does JBoss reopen a dead connection?

    Glauber Ribeiro Newbie

      I'm using JBoss 4.3. I have a data source defined like this:

       

          <min-pool-size>5</min-pool-size>
          <max-pool-size>25</max-pool-size>
          <validate-on-match>false</validate-on-match>
          <background-validation>true</background-validation>
          <idle-timeout-minutes>5</idle-timeout-minutes>
          <background-validation-minutes>1</background-validation-minutes>
          <prefill>true</prefill>

      <min-pool-size>5</min-pool-size>

      <max-pool-size>25</max-pool-size>

      <validate-on-match>false</validate-on-match>

      <background-validation>true</background-validation>

      <idle-timeout-minutes>10</idle-timeout-minutes>

      <background-validation-minutes>15</background-validation-minutes>

      <prefill>true</prefill>

       

      And i have the validation SQLs defined:
      <new-connection-sql>select 1</new-connection-sql>
      <check-valid-connection-sql>select 1</check-valid-connection-sql>

       

      Here's my problem: when there is a database failure (say, just for the sake of argument, i reboot the database server, to cause a failure) under load (that is, i'm constantly feeding transactions to my application, so it is trying to use the database all the time), JBoss continues to feed dead database connections to the application, until the background validation fires, at which point the connections are re-opened. So i see a bunch of errors in my application log that say things like "SQLException: invalid operation on closed connection", until the background validation fires and those connections are re-opened.

       

      I'm surprised this is happening. I thought a SQLException on a connection would cause JBoss to drop that connection from the pool, but instead, JBoss seems to be blissfully unaware that there is anything wrong with the connections, and keeps passing them back to the application. Why doesn't it? Is JBoss relying on the application re-throwing the SQLExceptions?

       

      Thanks for any help, pointers, etc.

       

      glauber