Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-4643

JDBCPersistence DB stopped during message send with JDBCIOExceptionHandler configured; IOException/SQLException is sent back (sometimes) to the client before the transport connector is shutdown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.8.0
    • 5.9.0
    • None
    • None
      • tested on trunk

    Description

      This related to AMQ-4636 JIRA for gtully's second point in comment https://issues.apache.org/jira/browse/AMQ-4636?focusedCommentId=13712196&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13712196

      Scenario:

      • Producer sending persistent message (no transaction)
      • JDBCIOExceptionHandler is configured
      • the underlying DB is shutdown during message send

      Result:
      One of two outcomes can happen:
      1) the broker sends the an IOException/SQLException wrapped in a JMSException (below) back to the client and then shuts down the transport connectors.
      2) the broker shuts down the transport connector when the IOException/SQLException is encountered.

      Expected behavior:
      As the JDBCIOHandler is configured which is handling the SQL exception, it would be good if the transport connectors were shutdown and no IOException/SQLException is reported to producer.

      2013-07-19 15:22:05,436 [main           ] - ERROR pDBDuringProducerSendTopicTest - unexpected exception caught
      javax.jms.JMSException: Database 'target/derbydb_15' not found.
      	at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54)
      	at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1391)
      	at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1319)
      	at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1809)
      	at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:289)
      	at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:224)
      	at org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
      	at org.apache.activemq.store.jdbc.StopDBDuringProducerSendTopicTest.sendMessage(StopDBDuringProducerSendTopicTest.java:150)
      	at org.apache.activemq.store.jdbc.StopDBDuringProducerSendTopicTest.testProducerWithDBShutdown(StopDBDuringProducerSendTopicTest.java:127)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at junit.framework.TestCase.runTest(TestCase.java:176)
      	at junit.framework.TestCase.runBare(TestCase.java:141)
      	at junit.framework.TestResult$1.protect(TestResult.java:122)
      	at junit.framework.TestResult.runProtected(TestResult.java:142)
      	at junit.framework.TestResult.run(TestResult.java:125)
      	at junit.framework.TestCase.run(TestCase.java:129)
      	at junit.framework.TestSuite.runTest(TestSuite.java:255)
      	at junit.framework.TestSuite.run(TestSuite.java:250)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
      	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
      	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
      	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:81)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      Caused by: java.io.IOException: Database 'target/derbydb_15' not found.
      	at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:45)
      	at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:68)
      	at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doAddMessage(DefaultJDBCAdapter.java:218)
      	at org.apache.activemq.store.jdbc.JDBCMessageStore.addMessage(JDBCMessageStore.java:123)
      	at org.apache.activemq.store.memory.MemoryTransactionStore.addMessage(MemoryTransactionStore.java:327)
      	at org.apache.activemq.store.memory.MemoryTransactionStore$2.asyncAddTopicMessage(MemoryTransactionStore.java:190)
      	at org.apache.activemq.broker.region.Topic.doMessageSend(Topic.java:482)
      	at org.apache.activemq.broker.region.Topic.send(Topic.java:446)
      	at org.apache.activemq.broker.region.AbstractRegion.send(AbstractRegion.java:406)
      	at org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:431)
      	at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:147)
      	at org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:96)
      	at org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:317)
      	at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:152)
      	at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:464)
      	at org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:751)
      	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294)
      	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:149)
      	at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
      	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
      	at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:288)
      	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
      	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214)
      	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
      	at java.lang.Thread.run(Thread.java:680)
      Caused by: java.sql.SQLException: Database 'target/derbydb_15' not found.
      	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
      	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
      	at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source)
      	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
      	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
      	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source)
      	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source)
      	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
      	at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source)
      	at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source)
      	at org.apache.activemq.store.jdbc.StopDBDuringProducerSendTopicTest$ReconnectingEmbeddedDataSource.getConnection(StopDBDuringProducerSendTopicTest.java:242)
      	at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:58)
      	... 23 more
      Caused by: java.lang.Throwable: org.apache.derby.impl.jdbc.EmbedSQLException: Database 'target/derbydb_15' not found.
      	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
      	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
      	... 38 more
      

      Attachments

        1. AMQ4643Test.java
          8 kB
          Pat Fox

        Issue Links

          Activity

            People

              gtully Gary Tully
              pgfox Pat Fox
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: