1 2 Previous Next 17 Replies Latest reply on Jul 17, 2006 1:08 PM by Konstantin

    Transactions in JBossCache 1.4CR2

    igsjboss Newbie

      Hello,

      We have been testing our code with 1.4CR2. We have found that if we put an object to the cahce with Transactions enabled the cache will thrown an exception (liste bellow).

      Glancing at the code it appears getCurrentTransaction is returning NULL when the current thread has no transactions. Should it be doing this? Under JBossCache 1.3, it created a new transaction if one currently did not exist.

      Ilan



      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...
      Caused by: java.lang.IllegalStateException: PojoCache.registerTxHanlder().
      Can't have null tx handle.
      at
      org.jboss.cache.aop.PojoCache.registerTxHandler(PojoCache.java:743)
      at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:729)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:461)
      ... 13 more


        • 1. Re: Transactions in JBossCache 1.4CR2
          igsjboss Newbie

          Thanks in advance for any assitance.

          Regards,
          Ilan

          • 2. Re: Transactions in JBossCache 1.4CR2
            Ben Wang Master

            Can you elaborate your test case? Looks like you are using PojoCache. If that's the case, 1) if you are using tx yourself, getCurrentTransaction() will return that tx, 2) if you are not, then I will detect it and initiate a transaction internally. In this case, getCurrentTransaction should not be null either.

            So I am a bit puzzled.

            Thanks,

            -Ben

            • 3. Re: Transactions in JBossCache 1.4CR2
              Manik Surtani Master

              Have you got a transaction manager registered?

              • 4. Re: Transactions in JBossCache 1.4CR2
                Ben Wang Master

                Hi, I have fixed one bug:
                http://jira.jboss.com/jira/browse/JBCACHE-691
                that I think is your problem. Basically, PojoCache will throw an exception if:

                1. You are using other tm, e.g., JBossTransactionManagerLookup classs

                2. You are not using any transaction, e.g., not tx.begin() in user code.

                Can you please verify? Thanks a lot.

                • 5. Re: Transactions in JBossCache 1.4CR2
                  igsjboss Newbie

                  Yes, we are using PojoCache and JBoss Transactions.

                  "ben.wang@jboss.com" wrote:
                  Can you elaborate your test case? Looks like you are using PojoCache. If that's the case, 1) if you are using tx yourself, getCurrentTransaction() will return that tx, 2) if you are not, then I will detect it and initiate a transaction internally. In this case, getCurrentTransaction should not be null either.

                  So I am a bit puzzled.

                  Thanks,

                  -Ben


                  • 6. Re: Transactions in JBossCache 1.4CR2
                    igsjboss Newbie

                    This update appears to resolve the errors we were seeing. Is this included in the GA release that was announced today?

                    "ben.wang@jboss.com" wrote:
                    Hi, I have fixed one bug:
                    http://jira.jboss.com/jira/browse/JBCACHE-691
                    that I think is your problem. Basically, PojoCache will throw an exception if:

                    1. You are using other tm, e.g., JBossTransactionManagerLookup classs

                    2. You are not using any transaction, e.g., not tx.begin() in user code.

                    Can you please verify? Thanks a lot.


                    • 8. Re: Transactions in JBossCache 1.4CR2
                      Konstantin Newbie

                      Thank you for answers and questions.
                      We are not using any transaction in error situation. But is it necessary for each operation with cache?
                      Last fix have not resolve our problem for using transactions with 1.4 version. I have gotten last head JBossCache version from CVS.
                      Now error trase is:
                      06-07-12 11:29:19,687 [main] ERROR ObjectManager ? - Exception:
                      java.lang.reflect.InvocationTargetException
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                      at java.lang.reflect.Method.invoke(Unknown Source)
                      at com.intersolved.xmlserver.deployer.ObjectManager.invokeMethod(ObjectManager.java:278)
                      at com.intersolved.xmlserver.deployer.ObjectManager.processInvoke(ObjectManager.java:297)
                      at com.intersolved.xmlserver.deployer.ObjectManager.start(ObjectManager.java:110)
                      at com.intersolved.xmlserver.Server.main(Server.java:32)
                      Caused by: java.lang.RuntimeException: PojoCache.putObject(): fqn: /<<SYSTEM-INF>>/STORAGES
                      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:477)
                      at com.intersolved.cluster.jsync.components.Synchronizer.putObject(Synchronizer.java:221)
                      at com.intersolved.xmlserver.global_services.synchronizator.SynchronizationMetaData.createMetaDataStructure(SynchronizationMetaData.java:49)
                      at com.intersolved.xmlserver.global_services.synchronizator.SynchronizationMetaData.(SynchronizationMetaData.java:33)
                      at com.intersolved.xmlserver.global_services.synchronizator.SynchronizationService2.initRootSynchronizationStorage(SynchronizationService2.java:36)
                      at com.intersolved.xmlserver.global_services.synchronizator._SynchronizationService.start(_SynchronizationService.java:32)
                      ... 8 more
                      Caused by: java.lang.IllegalStateException: PojoCache.registerTxHanlder(). Can't have null tx handle.
                      at org.jboss.cache.aop.PojoCache.registerTxHandler(PojoCache.java:743)
                      at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:729)
                      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:461)
                      ... 13 more

                      1.4 version have addition invoke registerTxHandler() in _putObject(Fqn fqn, Object obj).
                      For my mind the reason of current error situation is:
                      getLocalTransaction() method returns null when there is not transaction in current thread.
                      I think new transaction should be created for current thread in this situation.
                      Would you like to see the suspicions (for my mind :) code changes in version 1.4 for this situation?

                      • 9. Re: Transactions in JBossCache 1.4CR2
                        Ben Wang Master

                        Why dont you try it out from 1.4 release? I assume you are grabbing the cvs from JBossCache, of which is head for 2.0 now. We have branched out JBossCache_1_4_GA that has the code fix (for 1.4).

                        I haven't ported the fix since I am doing heavy refactoring in head now. :-)

                        • 10. Re: Transactions in JBossCache 1.4CR2
                          Konstantin Newbie

                           

                          "ben.wang@jboss.com" wrote:
                          Why dont you try it out from 1.4 release?

                          I have already tryied without success :
                          You are requesting file: /jboss/jboss-cache-dist-1.4.0.GA.zip
                          There was a problem downloading the file from surfnet.dl.sourceforge.net. Please try a different mirror.
                          Your download should begin shortly. If it does not, try http://switch.dl.sourceforge.net/sourceforge/jboss/jboss-cache-dist-1.4.0.GA.zip or choose a different mirror
                          Your download should begin shortly. If it does not, try http://optusnet.dl.sourceforge.net/sourceforge/jboss/jboss-cache-dist-1.4.0.GA.zip or choose a different mirror

                          • 11. Re: Transactions in JBossCache 1.4CR2
                            Konstantin Newbie

                             

                            "ben.wang@jboss.com" wrote:
                            Why dont you try it out from 1.4 release?

                            I have already tried without success:
                            Your download should begin shortly. If it does not, try http://superb-west.dl.sourceforge.net/sourceforge/jboss/jboss-cache-dist-1.4.0.GA.zip or choose a different mirror

                            You are requesting file: /jboss/jboss-cache-dist-1.4.0.GA.zip
                            There was a problem downloading the file from optusnet.dl.sourceforge.net. Please try a different mirror.

                            • 12. Re: Transactions in JBossCache 1.4CR2
                              igsjboss Newbie

                              Ben,

                              We later managed to pull this off a different mirror. We're testing again now.

                              Thanks,
                              Ilan

                              "KChvilyov" wrote:
                              "ben.wang@jboss.com" wrote:
                              Why dont you try it out from 1.4 release?

                              I have already tried without success:
                              Your download should begin shortly. If it does not, try http://superb-west.dl.sourceforge.net/sourceforge/jboss/jboss-cache-dist-1.4.0.GA.zip or choose a different mirror

                              You are requesting file: /jboss/jboss-cache-dist-1.4.0.GA.zip
                              There was a problem downloading the file from optusnet.dl.sourceforge.net. Please try a different mirror.


                              • 13. Re: Transactions in JBossCache 1.4CR2
                                Konstantin Newbie

                                Thahk you for 1.4 GA release. There is resolved previous error.
                                But we have a new:
                                java.lang.RuntimeException: PojoCache.putObject(): fqn: /poker/tournaments/1361/21/data at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:478) at org.jboss.cache.aop.CacheInterceptor.invoke(CacheInterceptor.java:152) at org.jboss.aop.joinpoint.FieldReadInvocation.invokeNext(FieldReadInvocation.java:48) at com.intersolved.poker.table.model.TableModelData.currRound_r_$aop(TableModelData.java) at com.intersolved.poker.table.model.TableModelData.getCurrRound(TableModelData.java:61) at com.intersolved.poker.table.model.TableModel.getCurrRound(TableModel.java:324) at com.intersolved.poker.table.services.hand.manager.AbstractHandManagerService.check(AbstractHandManagerService.java:327) at com.intersolved.poker.table.AbstractPokerTable.check(AbstractPokerTable.java:331) at com.intersolved.poker.lobby.tourney.tournaments.tournament.TournamentPokerTable.check(TournamentPokerTable.java:157) at com.intersolved.poker.lobby.tourney.tournaments.tournament.AbstractTournament.cleanTables(AbstractTournament.java:1042) at com.intersolved.poker.lobby.tourney.tournaments.tournament.AbstractTournament.handFinishedProcess(AbstractTournament.java:1158) at com.intersolved.poker.lobby.tourney.tournaments.tournament.AbstractTournament.processLosers(AbstractTournament.java:1099) at com.intersolved.poker.lobby.tourney.tournaments.tournament.TournamentPokerTable.onHandFinished(TournamentPokerTable.java:88) at com.intersolved.poker.table.services.hand.manager.TournamentHandManagerService.finish(TournamentHandManagerService.java:17) at com.intersolved.poker.table.services.hand.manager.AbstractHandManagerService.handProcess(AbstractHandManagerService.java:266) at com.intersolved.poker.table.services.hand.manager.AbstractHandManagerService.onTimer(AbstractHandManagerService.java:223) at com.intersolved.poker.table.AbstractPokerTable.onTimer(AbstractPokerTable.java:845) at com.intersolved.xmlserver.common.AbstractAsyncCommandExecutor.onEvent(AbstractAsyncCommandExecutor.java:63) at com.intersolved.xmlserver.common.AbstractCommandExecutor.execute(AbstractCommandExecutor.java:266) at com.intersolved.xmlserver.common.CommandExecutorQueue$PacketThreadQueueElement.executePacket(CommandExecutorQueue.java:89) at com.intersolved.xmlserver.common.CommandExecutorQueue$PacketThreadQueueElement.run(CommandExecutorQueue.java:71) at com.intersolved.xmlserver.common.queue.SynchronizedSystemThreadQueue$1.run(SynchronizedSystemThreadQueue.java:40) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Thread.java:595)Caused by: java.lang.RuntimeException: InternalDelegate.incrementRefCount(): null aopInstance for fqn: /poker/tournaments/1361/21/data at org.jboss.cache.aop.InternalDelegate.incrementRefCount(InternalDelegate.java:96) at org.jboss.cache.aop.ObjectGraphHandler.incrementRefCount(ObjectGraphHandler.java:212) at org.jboss.cache.aop.ObjectGraphHandler.setupRefCounting(ObjectGraphHandler.java:192) at org.jboss.cache.aop.ObjectGraphHandler.objectGraphPut(ObjectGraphHandler.java:88) at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:197) at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:731) at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:462) ... 23 more

                                • 14. Re: Transactions in JBossCache 1.4CR2
                                  Ben Wang Master

                                  1. Is it reproducible?
                                  2. I have noticed that there is concurrent worker in the stack trace. Are you updating the POJO concurrently? What is the update pattern? POJO is supposed to have long lifetime under PojoCache.

                                  1 2 Previous Next