Unexpected RollbackException during MultiThreadedTest
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Akiban Persistit |
Fix Released
|
Critical
|
Peter Beaman |
Bug Description
I ran MultiThreadedTest with 2 threads, each creating 5 COI groups. Even though the threads are writing rows with different PKs, a RollbackException is reported. The rollback does not appear to be due to application actions directly, but from a Persistit class named ClassIndex. The rollback does not occur with one application thread.
Marking this as Critical because it appears to be easy to provoke: Multiple threads doing writes. This occurred with autocommit set to either false or true.
Here is the stack:
Thread-5@3447, prio=5, in group 'main', status: 'RUNNING'
at com.persistit.
at com.persistit.
at com.persistit.
at com.persistit.
at com.persistit.
at com.persistit.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at com.akiban.
at java.lang.
This is completely reproducible. I suspect it's been happening for a while, but has become apparent due to therecent improved handling of rollbacks.
With N threads, the rollback is reported on N-1 of them, and it seems to always occur on the second group creation of each thread. (I've included complete output below from a run with 5 threads, each inserting 5 groups. The "thread X, creating customer Y" output comes from extra printlns that are not checked in.)
The test is not in trunk, but can be found in lp:~jack-akiban/akiban-build-scripts/20120713_multi_threaded_test. The output below was obtained with this command:
java -classpath target/
thread 1, creating customer 1000000000
thread 2, creating customer 2000000000
thread 3, creating customer 3000000000
thread 4, creating customer 4000000000
thread 5, creating customer 5000000000
thread 2, creating customer 2000000001
thread 5: ERROR: QUERY_ROLLBACK: Rollback
org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at com.akiban.
at com.akiban.
at com.akiban.
thread 5, creating customer 5000000001
thread 3: ERROR: QUERY_ROLLBACK: Rollback
org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at com.akiban.
at com.akiban.
at com.akiban.
thread 3, creating customer 3000000001
thread 1: ERROR: QUERY_ROLLBACK: Rollback
org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at com.akiban.
at com.akiban.
at com.akiban.
thread 1, creating customer 1000000001
thread 4: ERROR: QUERY_ROLLBACK: Rollback
org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at org.postgresql.
at com.akiban.
at com.akiban.
at com.akiban.
thread 4, creating customer 4000000001
thread 2, creating customer 2000000002
thread 3, creating customer 3000000002
thread 1, creating customer 1000000002
thread 4, creating customer 4000000002
thread 5, creating customer 5000000002
thread 2, creating customer 2000000003
thread 3, creating customer 3000000003
thread 4, creating customer 4000000003
thread 1, creating customer 1000000003
thread 5, creating customer 5000000003
thread 2, creating customer 2000000004
thread 1, creating customer 1000000004
thread 3, creating customer 3000000004
thread 5, creating customer 5000000004
thread 4, creating customer 4000000004
db.autocommit: false
db.driver: org.postgresql.
db.password: password
db.url: jdbc:postgresql
db.user: user
profile.
profile.
profile.
profile.
profile.
thread.actions: 0
thread.count: 5
thread.
Average time per thread (sec): 0.587400
Average rollbacks per thread: 0.800000
Related branches
- Peter Beaman: Approve
- Akiban Build User: Needs Fixing
- Nathan Williams: Approve
-
Diff: 767 lines (+407/-111)5 files modifiedsrc/main/java/com/persistit/ClassIndex.java (+153/-89)
src/main/java/com/persistit/ClassInfo.java (+5/-1)
src/main/java/com/persistit/Persistit.java (+7/-8)
src/test/java/com/persistit/ClassIndexTest.java (+213/-13)
src/test/java/com/persistit/MockSerializableObject.java (+29/-0)
visibility: | private → public |
Changed in akiban-persistit: | |
milestone: | none → 3.1.3 |
assignee: | nobody → Peter Beaman (pbeaman) |
Changed in akiban-persistit: | |
status: | New → Fix Committed |
Changed in akiban-persistit: | |
status: | Fix Committed → Fix Released |
I'm assuming they all start their writes simultaneously? And that they can continue successfully after this rollback? If so, a work around should be to commit one write first and then I don't think there shouldn't be any ww-conflicts.
This needs fixed, but I'm not optimistic about getting one done today.