You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by naql <an...@harcourt.com> on 2007/10/10 17:42:03 UTC

Yes, and it's an urgent problem [was Re: lock on Oracle activemq_lock table]


kmoore4now wrote:
> 
> I'm using the journaled JDBC approach to message persistence, with Oracle.
> It seems to work well most of the time. However, I'm finding that even
> after a normal shutdown a lock occasionally appears to be held on the
> activemq_lock table. This prevents ActiveMQ from starting up again on the
> next attempt.
> 
> Has anyone else seen this? Is there a way to avoid it?
> 

Yes.  I'm pretty sure the problem you're describing here is the same one
that I'm running into.  I previously posted regarding this on Oct 2nd as
"ActiveMQ installed as NT service takes a long, long time to restart".  I
thought it might be related to the servicewrapper, but it happens just
running it from the prompt whenever I use Oracle jdbc persistence.  I see
these messages in the log: 

2007-10-02 17:44:50,232 [erSimpleAppMain] INFO  DefaultDatabaseLocker         
- Attempting to acquire the exclusive lock to become the Master broker
2007-10-02 19:42:06,568 [erSimpleAppMain] INFO  DefaultDatabaseLocker         
- Becoming the master on dataSource:
org.apache.commons.dbcp.BasicDataSource@1972e

So, as you can see, in this example, it took 2 hours for ActiveMQ to start
up.  This doesn't happen when I fall back on the default persistence db,
comment out the Oracle datasource.  

This is a big deal to us and, along with the other issue I'm about to post
about, is a serious showstopper.

-- 
View this message in context: http://www.nabble.com/lock-on-Oracle-activemq_lock-table-tf4576911s2354.html#a13138495
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Yes, and it's an urgent problem [was Re: lock on Oracle activemq_lock table]

Posted by Mario Siegenthaler <ms...@inventsoft.ch>.
I don't know about how Oracle exactly handles that, but all of the DBs
I've seen so far remove the locks as soon as the connection holding
them is disconnected or closed or the transaction is rollbacked.
Since the 'old' broker isn't running anymore the connection is
disconnected.  And the locker rollbacks and closes the connection on
shutdown although (I did verify that, but only after I've applied
AMQ-1350 [I didn't want to overwrite my workspace I wrote the patch
in]).
So I really don't see why an Oracle database would leave locks behind
for a connection that did a rollback, was closed and is disconnected.

Mario

On 10/10/07, naql <an...@harcourt.com> wrote:
>
>
> kmoore4now wrote:
> >
> > I'm using the journaled JDBC approach to message persistence, with Oracle.
> > It seems to work well most of the time. However, I'm finding that even
> > after a normal shutdown a lock occasionally appears to be held on the
> > activemq_lock table. This prevents ActiveMQ from starting up again on the
> > next attempt.
> >
> > Has anyone else seen this? Is there a way to avoid it?
> >
>
> Yes.  I'm pretty sure the problem you're describing here is the same one
> that I'm running into.  I previously posted regarding this on Oct 2nd as
> "ActiveMQ installed as NT service takes a long, long time to restart".  I
> thought it might be related to the servicewrapper, but it happens just
> running it from the prompt whenever I use Oracle jdbc persistence.  I see
> these messages in the log:
>
> 2007-10-02 17:44:50,232 [erSimpleAppMain] INFO  DefaultDatabaseLocker
> - Attempting to acquire the exclusive lock to become the Master broker
> 2007-10-02 19:42:06,568 [erSimpleAppMain] INFO  DefaultDatabaseLocker
> - Becoming the master on dataSource:
> org.apache.commons.dbcp.BasicDataSource@1972e
>
> So, as you can see, in this example, it took 2 hours for ActiveMQ to start
> up.  This doesn't happen when I fall back on the default persistence db,
> comment out the Oracle datasource.
>
> This is a big deal to us and, along with the other issue I'm about to post
> about, is a serious showstopper.
>
> --
> View this message in context: http://www.nabble.com/lock-on-Oracle-activemq_lock-table-tf4576911s2354.html#a13138495
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Yes, and it's an urgent problem [was Re: lock on Oracle activemq_lock table]

Posted by kmoore4now <ke...@jkmoore.net>.
Hi Mario,

Thanks!

The problem does not occur only when ActiveMQ shuts down abnormally. It also
seems to occur when a db connection is lost due to network abnormalities,
while Active MQ is running.

Unfortunately, we do need to run in master / slave mode, so turning off db
locking as you suggest is not a good option for us.
-- 
View this message in context: http://www.nabble.com/lock-on-Oracle-activemq_lock-table-tf4576911s2354.html#a13144200
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Yes, and it's an urgent problem [was Re: lock on Oracle activemq_lock table]

Posted by Mario Siegenthaler <ms...@inventsoft.ch>.
I think that's a reasonable scenario, Oracle will actually have
trouble detecting them fast enough. I don't know if there's a setting
in Oracle that would speed up the checks. MySQL and MS SQL Server
detect the disconnect almost instantaneous.
However this should not happen on a clean shutdown. Which version of
ActiveMQ are you using? Maybe there's some problem with the shutdown
in your ActiveMQ-Version.

As a workaround you could turn off the db-locking. But that'll only
work if your not using jdbc-master/slave and if you can make sure that
only one broker is connected. The property to turn off database
locking (not all database locking, but the use of the lock table) is
useDatabaseLock.
So you could f.e. use:
   <persistenceAdapter>
        <jdbcPersistenceAdapter dataSource="#mysql-ds" useDatabaseLock="false"/>
    </persistenceAdapter>
This also works with the journaled jdbc.

Mario




On 10/10/07, kmoore4now <ke...@jkmoore.net> wrote:
>
> Perhaps stating the obvious... this seems to happen when there is some
> network instability and the connection to the database is lost. Because the
> connection is lost, ActiveMQ is unable to release the lock.
>
> The lock then stays on the table until Oracle is good and ready to delete
> it, which can be a very long time.
>
> As any FYI... it is possible for a DBA to delete the lock manually.
>
> This is very close to a show stopper for us as well.
> --
> View this message in context: http://www.nabble.com/lock-on-Oracle-activemq_lock-table-tf4576911s2354.html#a13140350
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Yes, and it's an urgent problem [was Re: lock on Oracle activemq_lock table]

Posted by kmoore4now <ke...@jkmoore.net>.
Perhaps stating the obvious... this seems to happen when there is some
network instability and the connection to the database is lost. Because the
connection is lost, ActiveMQ is unable to release the lock.

The lock then stays on the table until Oracle is good and ready to delete
it, which can be a very long time.

As any FYI... it is possible for a DBA to delete the lock manually.

This is very close to a show stopper for us as well.
-- 
View this message in context: http://www.nabble.com/lock-on-Oracle-activemq_lock-table-tf4576911s2354.html#a13140350
Sent from the ActiveMQ - User mailing list archive at Nabble.com.