4 Replies Latest reply on Sep 18, 2001 8:41 PM by Jemi Lehmann

    Experiencing Deadlock...

    the DUG Newbie

      I am experiencing deadlock when I hit my system with two concurrent users. It is not trivial to reproduce as it seem time dependent. I have to click around with two windows open or run loadRunner for awhile before it happens. I can't really find any evidence that it is reentrance that is causing the problem but I am witness the 2.2.2 issue of the logfile growing rapidly.

      I am considering to chalk this up to a 2.2.2 bug and try 2.4. But first can anybody suggest anything to look into? I have already tried many things but I can't seem to get the problem to go away, let alone begin to figure out what is happening..


        • 1. Re: Experiencing Deadlock...
          the DUG Newbie

          I upgraded to 2.4 and the problem still exists.

          • 2. Re: Experiencing Deadlock...
            Jeffrey Wescott Newbie

            We are suffering with the same issues. JBoss *ALWAYS* uses pessimistic locking for Entity beans. That is, if you use an entity bean (i.e. -- invoke any method on it) within the context of a transaction, that entity will be locked until the transaction commits, rolls back or times out. With this locking scheme, it's VERY easy for deadlock to occur with complex or long-running transactions. If you don't have any long-running transactions, one solution might be for you to lower your transaction timeout to a very small number (less than 5 seconds). This way, at least the deadlocks won't grind the system to a halt.

            • 3. Re: Experiencing Deadlock...
              Jemi Lehmann Newbie

              We also encountered the problem of flooded log files in case of locking situations and this is certinaly a bug that I hope will be fixed with the next version .

              Btw. another source of the locking besides the reentrance could be caused by your general architecture - some mistakes that we also made earlier. Locks and deadlocks can easily occur if you for instance have entity beans calling other entity beans, (which with a proper design should not be happening) or if you have two or more simultaneously running longer business processes encapsulated in a transaction contexts within session beans that happen to try to access the same enity beans. (In this case the first bean tries to complete the transaction and blocks resources, the second bean tries to do the same and locks resources up to the point where it needs to access entity beans locked by the first bean. If then the first bean encounters resouces bound by the second bean they are likely to keep on waiting for each other.) So checking your design with a dynamic perspective could be a good point to start solving your problem.


              • 4. Re: Experiencing Deadlock...
                Jemi Lehmann Newbie

                another tip. IN case you are using Container Managed Persitence it would also be worth checking whether you make use of the is modified flag. You can set the is modfied flag for an entity bean if you actually perform write operations that alter the contents of your database. (not for every read operation) You can configure JBoss then in a way that the persitency engine writes the beans only to the database in case the is modified flag is set.

                This way you maybe not only minimize the probablility of colliding requests that result in locking situations but also you will be surprised about the general performance increase of your system.