[
https://issues.apache.org/jira/browse/DERBY-4273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-4273:
--------------------------------------
Attachment: d4273.diff
I'm not able to reproduce this failure myself (except if I add some sleep()
calls), but I think the problem is that the helper thread uses more time than
expected before it commits the transaction and releases the X lock. After
locking the record, it sleeps for two seconds and then inserts 300 rows before
it commits. Since the lock timeout is four seconds, the test may fail if
inserting the 300 rows takes more than two seconds (closer to three seconds
should normally be OK since the the main thread waits one second before it
tries to retrieve the locked row).
But there's actually no reason why the lock timeout should be as low as four
seconds in this test. None of the test cases expect timeouts, so the test would
run as fast with a high timeout. The lowering of the timeout was added because
many of the test cases would fail with a timeout exception before DERBY-2991
was fixed, so it was faster to run the test during development that way.
Attached is a patch which makes the test use the default timeout values.
> A lock could not be obtained within the time requested error in
> testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique_split
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-4273
> URL: https://issues.apache.org/jira/browse/DERBY-4273
> Project: Derby
> Issue Type: Bug
> Components: Regression Test Failure
> Affects Versions: 10.5.1.2
> Reporter: Mamta A. Satoor
> Assignee: Knut Anders Hatlen
> Attachments: d4273.diff
>
>
> I recently merged changes for DERBY-3926 into 10.5.1.2 codeline (revision
> 784809) and I ran the junit tests on the merged code. The tests finished with
> one "A lock could not be obtained within the time requested". Knut suggested
> that I open a new jira entry for this issue. Copying his comment from
> DERBY-2991 here "Yes, that test was added for DERBY-2991.. It requires some
> coordination between two threads, so my first guess would be that there is a
> timing issue in the test. Please file a separate JIRA issue for this failure.
> Thanks. "
> Following is the stack track for the failure
> There was 1 error:
> 1)
> testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique_split(org.apache.derbyTesting.functionTests.tests.store.IndexSplitDeadlockTest)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.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:2201)
>
> at
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>
> at
> org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4338)
>
> at
> org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:467)
>
> at
> org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:371)
> at
> org.apache.derbyTesting.functionTests.tests.store.IndexSplitDeadlockTest.testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique_split(IndexSplitDeadlockTest.java:489)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:106)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
> at junit.extensions.TestSetup.run(TestSetup.java:23)
> at
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
> at junit.extensions.TestSetup.run(TestSetup.java:23)
> at
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> 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.ConcurrentLockSet.zeroDurationLockObject(ConcurrentLockSet.java:855)
>
> at
> org.apache.derby.impl.services.locks.AbstractPool.zeroDurationlockObject(AbstractPool.java:297)
>
> at
> org.apache.derby.impl.store.raw.xact.RowLocking2nohold.lockRecordForRead(RowLocking2nohold.java:89)
>
> 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:309)
>
> at
> org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(B2IRowLocking3.java:599)
>
> at
> org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR.lockScanRow(B2IRowLockingRR.java:105)
>
> at
> org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(BTreeForwardScan.java:305)
>
> at
> org.apache.derby.impl.store.access.btree.BTreeScan.fetchNextGroup(BTreeScan.java:1585)
>
> at
> org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>
> at
> org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>
> at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>
> at
> org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:427)
>
> ... 34 more
> FAILURES!!!
> Tests run: 9258, Failures: 0, Errors: 1
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.