Merge lp:~pbeaman/akiban-persistit/fix-1043536-deadlock-under-clover into lp:akiban-persistit

Proposed by Peter Beaman
Status: Merged
Approved by: Nathan Williams
Approved revision: 360
Merged at revision: 360
Proposed branch: lp:~pbeaman/akiban-persistit/fix-1043536-deadlock-under-clover
Merge into: lp:akiban-persistit
Diff against target: 59 lines (+6/-3)
4 files modified
src/test/java/com/persistit/AccumulatorTest.java (+1/-1)
src/test/java/com/persistit/JournalManagerTest.java (+1/-1)
src/test/java/com/persistit/MVCCConcurrentTest.java (+1/-1)
src/test/java/com/persistit/PersistitUnitTestCase.java (+3/-0)
To merge this branch: bzr merge lp:~pbeaman/akiban-persistit/fix-1043536-deadlock-under-clover
Reviewer Review Type Date Requested Status
Nathan Williams Approve
Review via email: mp+122104@code.launchpad.net

Description of the change

Fix bug 1043536 (we hope). The bug appears to occur when an assert caused by a timeout occurs in JournalManagerTest, leaving the ThreadSequencer state in an unexpectedly enabled state. The fix ensures that ThreadSequencer is disabled after every test, and it lengthens the timeouts by a factor of 5.

The theory behind lengthening the timeouts is that execution of the instrumented Clover code is much slower and therefore threads that normally complete in much less than the sanity timeout are slow enough under Clover to exceed the timeout. There's no proof that 5x is sufficient or necessary, but there's also no proof that the original timeouts were reasonable; they are chosen as a sanity outer bound, and the objective of the timeout should be to eventually signal a failure-to-complete problem within a scale that's reasonable given that the test machines need to perform other tasks.

I was unable to reproduce this phenomenon and therefore have no unit test for it. The test will be whether persistit-coverage continues to fail in the same way.

To post a comment you must log in.
Revision history for this message
Nathan Williams (nwilliams) wrote :

Looks reasonable to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/test/java/com/persistit/AccumulatorTest.java'
2--- src/test/java/com/persistit/AccumulatorTest.java 2012-08-24 13:57:19 +0000
3+++ src/test/java/com/persistit/AccumulatorTest.java 2012-08-30 16:32:18 +0000
4@@ -479,7 +479,7 @@
5
6 @Test
7 public void testDeltasCombineMultiAccumMultiThread() throws Exception {
8- final long RUN_TIME_MAX = 10000;
9+ final long RUN_TIME_MAX = 50000;
10 final int THREAD_COUNT = 20;
11 final int ACCUM_COUNT = 10;
12 final int STEP_COUNT = 5;
13
14=== modified file 'src/test/java/com/persistit/JournalManagerTest.java'
15--- src/test/java/com/persistit/JournalManagerTest.java 2012-08-24 13:57:19 +0000
16+++ src/test/java/com/persistit/JournalManagerTest.java 2012-08-30 16:32:18 +0000
17@@ -677,7 +677,7 @@
18 */
19 enableSequencer(true);
20 addSchedules(PAGE_MAP_READ_INVALIDATE_SCHEDULE);
21- startAndJoinAssertSuccess(5000, thread1, thread2);
22+ startAndJoinAssertSuccess(25000, thread1, thread2);
23 disableSequencer();
24 }
25
26
27=== modified file 'src/test/java/com/persistit/MVCCConcurrentTest.java'
28--- src/test/java/com/persistit/MVCCConcurrentTest.java 2012-08-24 13:57:19 +0000
29+++ src/test/java/com/persistit/MVCCConcurrentTest.java 2012-08-30 16:32:18 +0000
30@@ -74,7 +74,7 @@
31 }
32 });
33
34- startAndJoinAssertSuccess(5000, readThread, writeThread, removeThread);
35+ startAndJoinAssertSuccess(25000, readThread, writeThread, removeThread);
36 }
37
38 //
39
40=== modified file 'src/test/java/com/persistit/PersistitUnitTestCase.java'
41--- src/test/java/com/persistit/PersistitUnitTestCase.java 2012-08-15 16:12:34 +0000
42+++ src/test/java/com/persistit/PersistitUnitTestCase.java 2012-08-30 16:32:18 +0000
43@@ -24,6 +24,7 @@
44
45 import com.persistit.exception.PersistitException;
46 import com.persistit.unit.UnitTestProperties;
47+import com.persistit.util.ThreadSequencer;
48
49 public abstract class PersistitUnitTestCase {
50
51@@ -58,6 +59,8 @@
52
53 @After
54 public void tearDown() throws Exception {
55+ // Ensure sequencer is disabled after each test.
56+ ThreadSequencer.disableSequencer();
57 final WeakReference<Persistit> ref = new WeakReference<Persistit>(_persistit);
58 _persistit.close(false);
59 _persistit = null;

Subscribers

People subscribed via source and target branches