8 Replies Latest reply on May 11, 2004 6:19 PM by fabinhu

    JBoss transaction deadlock

    fabinhu Newbie

      Guys,

      i have a "little" problem with my application (JSP/Servlet/JBoss/JTA).
      I made some stress test, simulating 6 users with threads and make request to my application for access database using JTA.
      But when the transaction finish, the tables access for one user continue blocked. That's mean DEADLOCK. And the other users can't access and the application "stops".

      Means that the transaction don't commit.

      Anyone here can help me to configure my JBoss with transaction ???

      []'s

        • 1. Re: JBoss transaction deadlock
          Darran Lofthouse Master

          Which JBoss version are you using?

          Which database? I have had a similar situation with some databases but not others.

          What is in your *-ds.xml for the data source?

          Have you changed any of the transaction settings in your deployment descriptors?

          • 2. Re: JBoss transaction deadlock
            fabinhu Newbie

            Th version of JBoss is 3.2.3

            My application runs in Oracle, SQL Server, Postgresql...and all i had deadlock.

            In my mssql-ds.xml:


            <local-tx-datasource>
            <jndi-name>jdbc/XSCXPLAN</jndi-name>
            <connection-url>jdbc:microsoft:sqlserver://xplsvr01:1433;SelectMethod=cursor</connection-url>
            <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
            <user-name>user1</user-name>
            <password>user1</password>
            <prepared-statement-cache-size>0</prepared-statement-cache-size>
            <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
            <blocking-timeout-millis>1000</blocking-timeout-millis>
            </local-tx-datasource>

            • 3. Re: JBoss transaction deadlock
              fabinhu Newbie

              And...

              That's the exception:

              [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Transaction (Process ID 68) was deadlocked on {lock} resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

              • 4. Re: JBoss transaction deadlock
                stscit04 Newbie

                Hi,

                when does the lock ocour ? on
                ejbFind or on the first invokation of an beans getXX / setXXX method ?

                Stefan

                • 5. Re: JBoss transaction deadlock
                  fabinhu Newbie

                  My application doens't have EJBs.

                  The architecture of my application is:

                  Servlet -> Handler(S) -> Components (BO, DAO, JavaBeans-Model).

                  And the DAO use JTA to make a transaction and access the database.

                  when some threads finish up, some tables access are blocked. So, the other threads can't access because tha process in the database is DEADLOCK!

                  Is not my code, because i had the same trouble in other application server...
                  The problem is --> The transaction don't commit JBDC calls statements.

                  • 6. Re: JBoss transaction deadlock
                    Tom Vekemans Newbie

                    I have that same error when a process/user/ejb/... of a Connection of the pool puts a lock on objects (records, pages, whole tables!) in the database, and does not release this lock quickly enough. In the meanwhile, other processes/users/ejbs/... try to access these locked resources, and if they don't get it in time you will receive the error you had.

                    I think the MS SQLServer message isn't quite correct. It is not deadlock, where 2 processes hold reqources that the other needs. It is more like a timeout. However, this situation tends to snowball, having JBoss opening new connections to the DB until the maximum pool size is reached.

                    What I have done until now is rewrite the code (always the first step ;-) )so that the DB is less sollicited, and optimize transactions declaratively so that locks are taken on smaller objects (records rather than tables) and for shorter durations. It's an EJB application. Yours is not, so who is managing YOUR transactions? At this moment we can run 100+ concurrent (i.e. working, not just logged in) users without problems. Another thing to do is optimize your DB: create indexes etc.

                    But start with looking at your code: if you had the same problem on other application servers then JBoss isn't the answer.

                    • 7. Re: JBoss transaction deadlock
                      fabinhu Newbie

                      But, in other application servers like JRun, i could resolve this problem...

                      With JBoss, how can i configure my transaction pool ? So, when my application start a transaction and use, its can COMMIT THE STATEMENTS CALLS!!!!!!!

                      HELPPPP!! PEOPLE!

                      • 8. Re: JBoss transaction deadlock
                        fabinhu Newbie

                        Continue the last post...

                        Because, today my transaction DON'T COMMIT THE STATEMENTS CALLS!!!!!!!!!

                        :'(