db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5278) AssertionFailedError in IndexSplitDeadlockTest.testBTreeForwardScan_fetchRows_resumeAfterWait_unique_split()
Date Thu, 16 Jun 2011 09:43:47 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-5278:
--------------------------------------

    Attachment: sync.diff

The test case that fails runs in two threads that need to do the operations in a specific
order. Currently, the threads use Thread.sleep() to ensure the ordering. This may break if
the timing isn't quite what we expect.

It looks like the assert failure happens because the helper thread has started inserting new
rows into the table too early. It should wait until the main thread has started an index scan
and got blocked on a lock that the helper thread is holding.

The attached patch (sync.diff) makes the threads synchronize using an object on which they
call wait/notify to tell the other thread that they're in the expected state. This should
be more reliable than Thread.sleep(), and it should also make the test run slightly faster
in the common case, since the sleep time is probably higher than needed on most machines.

Now the helper thread will know that the main thread is ready to start the index scan before
it goes ahead inserting more rows. And the main thread knows that the helper thread has obtained
the required lock before it starts the index scan. There's still one sleep() call in the test
case to ensure that the index scan has actually started before the helper thread begins inserting,
but since both threads are in a well-known state when sleep() is called, it should be much
more likely to work as intended.

> AssertionFailedError in IndexSplitDeadlockTest.testBTreeForwardScan_fetchRows_resumeAfterWait_unique_split()
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5278
>                 URL: https://issues.apache.org/jira/browse/DERBY-5278
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.9.0.0
>         Environment: java version "1.4.2_30"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_30-b04)
> Java HotSpot(TM) Client VM (build 1.4.2_30-b04, mixed mode)
> Red Hat Enterprise Linux Server release 5.1 (Tikanga)
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: sync.diff
>
>
> This failure has been seen occasionally (three times so far) on Java 1.4.2_30 on Linux.
Examples:
> http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.4/testing/testlog/lin/1095760-suitesAll_diff.txt
> http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.4/testing/testlog/lin/1102361-suitesAll_diff.txt
> http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.4/testing/testlog/lin/1133954-suitesAll_diff.txt
> 1) testBTreeForwardScan_fetchRows_resumeAfterWait_unique_split(org.apache.derbyTesting.functionTests.tests.store.IndexSplitDeadlockTest)junit.framework.AssertionFailedError:
expected:<0> but was:<-299>
> 	at org.apache.derbyTesting.functionTests.tests.store.IndexSplitDeadlockTest.testBTreeForwardScan_fetchRows_resumeAfterWait_unique_split(IndexSplitDeadlockTest.java:397)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> 	at junit.extensions.TestSetup.run(TestSetup.java:25)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> 	at junit.extensions.TestSetup.run(TestSetup.java:25)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message