JDBC Master/Slave: After database failure, stale db connections are reused in 
DefaultdatabaseLocker
---------------------------------------------------------------------------------------------------

                 Key: AMQ-1263
                 URL: https://issues.apache.org/activemq/browse/AMQ-1263
             Project: ActiveMQ
          Issue Type: Bug
          Components: Message Store
    Affects Versions: 4.x
         Environment: Linux x86, Postgresql 8.1
            Reporter: Eric Anderson
         Attachments: patch.txt

Start two brokers in a JDBC master/slave configuration.  One will become 
master, the other slave.
Shutdown the database.
The slave will immediately begin emitting emitting database connection 
exceptions messages from the DefaultdatabaseLocker.
Bring up the database again.
The slave continues to emit database error messages and all subsequent attempts 
by the DefaultdatabaseLocker to issue its locking query will fail.

The problem is that the DefaultdatabaseLocker grabs one db connection at 
startup and never releases it.  Therefore unless the JDBC connection has an 
auto-reconnect feature, the slave broker is dead in the water, because its 
Connection is bad.  The fix is to allocate a new Connection and 
PreparedStatement on every iteration of the database locker loop, and free the 
statement/connection on any Exception.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to