8 Replies Latest reply: Feb 29, 2012 8:26 AM by Andy Taylor RSS

    Transaction Timeouts not working - help

    1977 Newbie

      I have a MessageListener on a queue that needs to do a lot of time consuming  tasks for each message it recieves. But I cannot seem to change the timeout.

       

      I.ve tried setting the following in hornetq-configuration.xml

       

      <transaction-timeout>600000</transaction-timeout>   (i.e. 10mins)

       

       

      but it always seems to timeout after 5 mins with the following error

       

      21:31:27,895 WARN  [com.arjuna.ats.arjuna] ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a8000c:126a:4f4d37a6:65e in state  RUN

      21:31:27,896 WARN  [com.arjuna.ats.arjuna] ARJUNA-12095 Abort of action id 0:ffffc0a8000c:126a:4f4d37a6:65e invoked while multiple threads active within it.

      21:31:27,896 WARN  [com.arjuna.ats.arjuna] ARJUNA-12108 CheckedAction::check - atomic action 0:ffffc0a8000c:126a:4f4d37a6:65e aborting with 1 threads active!

      21:31:27,896 WARN  [com.arjuna.ats.arjuna] ARJUNA-12121 TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,jboss] successfully canceled TX 0:ffffc0a8000c:126a:4f4d37a6:65e

      22:25:49,794 WARN  [com.arjuna.ats.arjuna] ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a8000c:126a:4f4d37a6:1a40 in state  RUN

      22:25:49,794 WARN  [com.arjuna.ats.arjuna] ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a8000c:126a:4f4d37a6:1a41 in state  RUN

      22:25:49,794 WARN  [com.arjuna.ats.arjuna] ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a8000c:126a:4f4d37a6:1a42 in state  RUN

      22:25:49,794 WARN  [com.arjuna.ats.arjuna] ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a8000c:126a:4f4d37a6:1a43 in state  RUN

       

       

      anyone know a way around this?

       

      p.s for the moment I ve stripped out all db access to try to narrow in on the problem

       

       

      also - Im using spring and have set the transaction manager to my jta transaction manager

       

      <jms:listener-container connection-factory="queueConnectionFactory" concurrency="10" acknowledge="transacted" transaction-manager="transactionManager">

              <jms:listener destination="PullPhotosQueue" ref="pullPhotosListener"/>

       

       

      <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">

              <property name="transactionManagerName" value="java:/TransactionManager"/>

              <property name="userTransactionName" value="UserTransaction"/>

          </bean>

        • 1. Re: Transaction Timeouts not working - help
          Justin Bertram Master

          In which version of JBoss AS is this deployed?  I think you need to change the default transaction timeout for the transaction manager.

          • 2. Re: Transaction Timeouts not working - help
            1977 Newbie

            I am using jboss-6.0.0.Final

            • 3. Re: Transaction Timeouts not working - help
              Justin Bertram Master

              Check out the "defaultTimeout" property of the "CoordinatorEnvironmentBean" bean in deploy/transaction-jboss-beans.xml.  Change that and let me know how it goes.

              • 4. Re: Transaction Timeouts not working - help
                Justin Bertram Master

                To be clear, the <transaction-timeout> set in hornetq-configuration.xml is related to HornetQ as a resource manager.  There is still the transaction manager timeout to deal with.

                • 5. Re: Transaction Timeouts not working - help
                  1977 Newbie

                  yes this works !  so I've set it to some really big value

                   

                  However now all transactions used by my spring services/daos will have this big default value which means I will have to explicity set a @Transactional(timeout =xxxx) on each of these.

                   

                   

                  Im a bit confused as to why @Transactional(timeout = yyy) will not work on my JMS message listener.

                   

                  I would really like to be able to  make transactions long for individual jms listeners rather than them all

                   

                   

                  @Component

                  @Transactional( timeout = 60 * 60 * 24 * 31 )   //does not seem to work

                  public class PullPhotosListener implements MessageListener {

                     

                      @Autowired

                      private SocialNetworksService socialNetworksService;

                   

                   

                      @Autowired

                      private SocialUserService socialUserService;

                   

                   

                      @Autowired

                      private UserService userService;

                   

                   

                      @Autowired

                      private PhotoService photoService;

                   

                   

                      @Autowired

                      private SolrService solrService;

                   

                   

                      @Autowired

                      private CityService cityService;

                   

                   

                    

                      @Override

                      public void onMessage(final Message message) {

                          try {

                              MapMessage mapMessage = (MapMessage) message;

                              Long socialUserId = mapMessage.getLong("socialUserId");

                              Long userId = mapMessage.getLong("userId");

                  • 6. Re: Transaction Timeouts not working - help
                    Andy Taylor Master

                    Im not sure how you are deploying your message listener but if you set the tx timeout on the resource adapter or MDB activation properties it should work.

                    • 7. Re: Transaction Timeouts not working - help
                      1977 Newbie

                      what do you mean - resource adapter or MDB activation properties ?

                       

                       

                       

                      this is my configuration

                       

                       

                      @Component

                      @Transactional( timeout = 60 * 60 * 24 * 31 )   //does not seem to work

                      public class PullPhotosListener implements MessageListener {

                       

                      ...

                      ...

                      }

                       

                       

                      spring config file

                       

                      <jms:listener-container connection-factory="queueConnectionFactory" concurrency="10" acknowledge="transacted" transaction-manager="transactionManager">

                              <jms:listener destination="PullPhotosQueue" ref="pullPhotosListener"/>

                       

                       

                      <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">

                              <property name="transactionManagerName" value="java:/TransactionManager"/>

                              <property name="userTransactionName" value="UserTransaction"/>

                          </bean>

                       

                       

                       

                       

                      in hornetq-jms.xml

                       

                      <connection-factory name="NettyConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="netty"/>

                              </connectors>

                              <entries>

                                  <entry name="/ConnectionFactory"/>

                                  <entry name="/XAConnectionFactory"/>

                              </entries>

                          </connection-factory>

                       

                       

                          <connection-factory name="NettyThroughputConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="netty-throughput"/>

                              </connectors>

                              <entries>

                                  <entry name="/ThroughputConnectionFactory"/>

                                  <entry name="/XAThroughputConnectionFactory"/>

                              </entries>

                          </connection-factory>

                       

                       

                          <connection-factory name="InVMConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/ConnectionFactory"/>

                                  <entry name="java:/XAConnectionFactory"/>

                              </entries>

                          </connection-factory>

                       

                       

                      <queue name="PullPhotosQueue">

                              <entry name="/queue/PullPhotosQueue"/>

                          </queue>

                      • 8. Re: Transaction Timeouts not working - help
                        Andy Taylor Master

                        on an MDB you would have something like

                         

                        @MessageDriven(name = "MDB_CMT_TxRequiredExample", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

                                                                                               @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"),

                                                                                               @ActivationConfigProperty(propertyName = "transactionTimeout", propertyValue = "10000")}) <-------------------------------------------------

                        @TransactionManagement(value = TransactionManagementType.CONTAINER)

                        @TransactionAttribute(value = TransactionAttributeType.REQUIRED)

                        public class MDB_CMT_TxRequiredExample implements MessageListener