[ 
https://issues.apache.org/jira/browse/DERBY-2220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463032
 ] 

Julius Stroffek commented on DERBY-2220:
----------------------------------------

The way how to reproduce the error:

Run the derby server on localhost (pass these options to java: 
-Dderby.locks.monitor=true -Dderby.locks.deadlockTrace=true). Execute a code in 
xxx.sql, run the XATransactionTest.java. Use ij tool to connect to a TestDB 
database on localhost. Execute the query 'select * from dummy;' After a couple 
of seconds you will get a message

ij> select * from dummy;
ERROR 40XL2: A lock could not be obtained within the time requested.  The 
lockTable dump is:
2007-01-08 13:12:52.610 GMT
XID       |TYPE         |MODE|LOCKCOUNT|LOCKNAME                                
                                        |STATE|TABLETYPE / LOCKOBJ              
     |INDEXNAME / CONTAINER_ID / (MODE for LATCH only)  |TABLENAME / CONGLOM_ID 
               |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*** The following row is the victim ***
131       |ROW          |S   |0        |(1,7)                                   
                                        |WAIT |T                             
|NULL                                              |DUMMY                       
          |
*** The above row is the victim ***
130       |ROW          |X   |1        |(1,7)                                   
                                        |GRANT|T                             
|NULL                                              |DUMMY                       
          |
130       |TABLE        |IX  |1        |Tablelock                               
                                        |GRANT|T                             
|NULL                                              |DUMMY                       
          |
131       |TABLE        |IS  |1        |Tablelock                               
                                        |GRANT|T                             
|NULL                                              |DUMMY                       
          |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


> Transaction executed throught XAResource will held locks forever (until 
> commit is executed) and also after the application terminates.
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2220
>                 URL: https://issues.apache.org/jira/browse/DERBY-2220
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 49, Sun's JDK1.6
>            Reporter: Julius Stroffek
>         Attachments: XATranTest.java, xxx.sql
>
>
> Using this pieco of code derby will not release a table lock of 'dummy' table.
>             String query = "insert into dummy (field1) values ('" + 
> Integer.toString(value) + "')";
>             XAConnection xaConnection = 
> createXAConnection("jdbc:derby://localhost:1527/TestDB", "", "");
>             XAResource xaResource = xaConnection.getXAResource();
>             conn = xaConnection.getConnection();
>             
>             Xid xid = createXid(value);        
>             xaResource.setTransactionTimeout(10);
>             xaResource.start(xid, XAResource.TMNOFLAGS);
>             
>             Statement statement = conn.createStatement();
>             statement.execute(query);        
>             
>             // terminate the client application
>             // this will not release any locks
>             System.exit(0);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to