1 2 Previous Next 21 Replies Latest reply on Apr 24, 2009 2:54 AM by mauromol Go to original post
      • 15. Re: Using JBoss JTA embedded in a webapp: leak because of Re
        mauromol

         

        "adinn" wrote:

        If Transaction Reaper simply calls the two private shutdown methods for the Reaper and ReaperWorker threads then they will exit.


        "adinn" wrote:

        Interrupting transactional threads is a non-starter as far as I am concerned. For a start what threads? There may not be anything running any code associated with the TX at the point of shutdown. Even if there is a candidate thread, interrupting it at an arbitrary point is a really, really dumb idea (no, don't ask me how dumb -- you will regret it).


        Just to clarify what I have written before: I didn't mean to cause the transactional threads to be interrupted, I just meant that if you simply call shutdown on the two ReapertWorker threads as far as I understand by looking at the code and by making a couple of tests, they obviously actually won't shutdown if they are in waiting state (that is: ReaperThread is at reaperObject.wait(sleepPeriod) while ReaperWorkerThread is at _theReaper.waitForCancellations() or _theReaper.doCancellations()).

        My guess is that if you make the transactiona thread exit gracefully, as you propose, the ReaperWorkerThread will move on and, at last, stop (if shutdown has been invoked), however it is not clear to me what sleepPeriod actually is for ReaperThread. I would guess it is controlled by the com.arjuna.ats.arjuna.coordinator.txReaperTimeout property in jbossjta-properties.xml, however looking at the code I couldn't find any call to com.arjuna.ats.arjuna.coordinator.TransactionReaper.create(long) except for that of com.arjuna.ats.arjuna.coordinator.TransactionReaper.create() which fixes the checkPeriod to com.arjuna.ats.arjuna.coordinator.TransactionReaper.defaultCheckPeriod (120000 milliseconds). Correct me if I'm wrong.

        Thank you for your support!

        Mauro.

        So, if we a do add a public shutdown call on TransactionReaperaddingthen it might be useful to add flags to configure whether to call cancel/preventCommit and/or whether to wait for TX exits.


        • 16. Re: Using JBoss JTA embedded in a webapp: leak because of Re
          mauromol

           

          "mauromol" wrote:
          "adinn" wrote:

          So, if we a do add a public shutdown call on TransactionReaperaddingthen it might be useful to add flags to configure whether to call cancel/preventCommit and/or whether to wait for TX exits.


          Sorry please ignore the part that is following my signature in my previous message, I forgot to remove it :-P

          Mauro.


          • 17. Re: Using JBoss JTA embedded in a webapp: leak because of Re
            adinn

             


            Just to clarify what I have written before: I didn't mean to cause the transactional threads to be interrupted, I just meant that if you simply call shutdown on the two ReapertWorker threads as far as I understand by looking at the code and by making a couple of tests, they obviously actually won't shutdown if they are in waiting state (that is: ReaperThread is at reaperObject.wait(sleepPeriod) while ReaperWorkerThread is at _theReaper.waitForCancellations() or _theReaper.doCancellations()).


            Yes, that is true. The ReaperThread and ReaperWorkerThread instances wait on, respectively, the TransactionReaper instance and the TransactionReaper work queue. The calls to shutdown need to be followed by calls to notify on these objects.

            • 18. Re: Using JBoss JTA embedded in a webapp: leak because of Re
              mauromol

               

              "adinn" wrote:

              Yes, that is true. The ReaperThread and ReaperWorkerThread instances wait on, respectively, the TransactionReaper instance and the TransactionReaper work queue. The calls to shutdown need to be followed by calls to notify on these objects.


              Thank you! This actually helped! Do you suggest any preferred order in shutting down ReaperThread and ReaperWorkerThread?

              By the way, I opened https://jira.jboss.org/jira/browse/JBTM-464 for the disposal of TxControl.

              Mauro.

              • 19. Re: Using JBoss JTA embedded in a webapp: leak because of Re
                adinn

                 


                Thank you! This actually helped! Do you suggest any preferred order in shutting down ReaperThread and ReaperWorkerThread?


                Until there is some way of ensuring that the ReaperThread and ReaperWorkerThread deplete the TransactionReaper's list of ReaperElement instances (_transactions) and the work queue before acknowledging the shutdown it really doesn't make any difference.

                • 20. Re: Using JBoss JTA embedded in a webapp: leak because of Re
                  marklittle

                   

                  "adinn" wrote:

                  ReaperThread appears to have implemented a public shutdown() method since 4.2.1. This does not appear to have been called by the TransactionReaper in 4.2.1 or later releases. Since the thread is private this means there was no shutdown API from 4.2.1 onwards.

                  I added a similar shutdown method to class ReaperWorkerThread when I created it in 4.3.0. Given the lack of a shutdown API for TransactionReaper I did not add any call to this latter shutdown method.

                  If Transaction Reaper simply calls the two private shutdown methods for the Reaper and ReaperWorker threads then they will exit. However, this may still leave transactions running without anything to time them out which may or may not have the desired effect. I'm not sure what would be better but here are some thoughts.

                  Preventing the transaction from committing might be appropriate (if we do this as per the ReaperWorker thread that means calling e.cancel() and, if that fails then e.prevent_commit()).

                  Waiting for all currently active transactions to remove themselves from the reaper list before returning from the shutdown API might also be desirable.

                  Interrupting transactional threads is a non-starter as far as I am concerned. For a start what threads? There may not be anything running any code associated with the TX at the point of shutdown. Even if there is a candidate thread, interrupting it at an arbitrary point is a really, really dumb idea (no, don't ask me how dumb -- you will regret it).

                  So, if we a do add a public shutdown call on TransactionReaperaddingthen it might be useful to add flags to configure whether to call cancel/preventCommit and/or whether to wait for TX exits.


                  Just saw this, but it's all pretty much in line with what I did last night. Just running some soak tests at the moment.

                  • 21. Re: Using JBoss JTA embedded in a webapp: leak because of Re
                    mauromol

                    Hello! I found another memory leak problem, similar to JBTM-464, which I thought it had been addressed in JBTM-468, but it had not.

                    I filed https://jira.jboss.org/jira/browse/JBTM-535 for it.

                    Mauro.

                    1 2 Previous Next