db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: [jira] Commented: (DERBY-3678) StackOverflowException in deadlock trace
Date Mon, 26 May 2008 00:32:17 GMT

The following scenario creates a hang when a 2nd connection is made
for the user "newuser":

> java -Dij.exceptionTrace=true org.apache.derby.tools.ij

ij> connect 'jdbc:derby:wombat;user=newuser';
                            -- no schema is yet created for newuser.                     
    
ij> autocommit off;
ij> create table i (i int); -- the schema is only created for 'newuser' at this point
0 rows inserted/updated/deleted

Notice that this session has not yet committed... now we make a new
session with the same user:

ij> connect 'jdbc:derby:wombat;user=newuser';
ERROR 40XL1: A lock could not be obtained within the time requested

Might this be what happens for you?  The first time a new user
connects and creates a database object, his schema will be
created. But until that session commits, another session cannot login
with the same user name, since the new entry in SYSSCHEMAS
corresponding to the new user's schema has not been committed either
(it has a write lock on it so it can't be read by the second session).

Note, even if you don't use explicit users, there will still be be an
implicit user, so the same thing applies.

Dag

ERROR 40XL1: A lock could not be obtained within the time requested
(full stack trace I got):

java.sql.SQLTransactionRollbackException: A lock could not be obtained within the time requested
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:88)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2179)
	at org.apache.derby.impl.jdbc.EmbedConnection.checkUserIsNotARole(EmbedConnection.java:1197)
	at org.apache.derby.impl.jdbc.EmbedConnection.checkUserCredentials(EmbedConnection.java:1130)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:398)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:54)
	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:68)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:238)
	at org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:119)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:1237)
	at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:1087)
	at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:915)
	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:328)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
	at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
	at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: java.sql.SQLException: A lock could not be obtained within the time requested
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
	... 23 more
Caused by: ERROR 40XL1: A lock could not be obtained within the time requested
	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276)
	at org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(ConcurrentLockSet.java:602)
	at org.apache.derby.impl.services.locks.AbstractPool.lockObject(AbstractPool.java:117)
	at org.apache.derby.impl.services.locks.ConcurrentPool.lockObject(ConcurrentPool.java:28)
	at org.apache.derby.impl.store.raw.xact.RowLocking3.lockRecordForRead(RowLocking3.java:187)
	at org.apache.derby.impl.store.access.heap.HeapController.lockRow(HeapController.java:520)
	at org.apache.derby.impl.store.access.heap.HeapController.lockRow(HeapController.java:638)
	at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(B2IRowLocking3.java:335)
	at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(B2IRowLocking3.java:628)
	at org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR.lockScanRow(B2IRowLockingRR.java:112)
	at org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(BTreeForwardScan.java:304)
	at org.apache.derby.impl.store.access.btree.BTreeScan.next(BTreeScan.java:1756)
	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java:8243)
	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1559)
	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1469)
	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initDefaultSchemaDescriptor(GenericLanguageConnectionContext.java:370)
	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initialize(GenericLanguageConnectionContext.java:347)
	at org.apache.derby.impl.db.BasicDatabase.setupConnection(BasicDatabase.java:309)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.startTransaction(TransactionResourceImpl.java:188)
	at org.apache.derby.impl.jdbc.EmbedConnection.checkUserIsNotARole(EmbedConnection.java:1166)
	... 18 more
ij> 

Mime
View raw message