Skip to content

Commit 1c8688c

Browse files
committed
reproduce test failure
1 parent 59eba18 commit 1c8688c

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

testsuites/sail/src/main/java/org/eclipse/rdf4j/testsuite/sail/SailConcurrencyTest.java

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.concurrent.atomic.AtomicInteger;
2121
import java.util.concurrent.atomic.AtomicReference;
2222

23+
import org.eclipse.rdf4j.common.concurrent.locks.Properties;
2324
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
2425
import org.eclipse.rdf4j.common.transaction.IsolationLevels;
2526
import org.eclipse.rdf4j.model.IRI;
@@ -36,7 +37,7 @@
3637
import org.junit.jupiter.api.Assertions;
3738
import org.junit.jupiter.api.BeforeEach;
3839
import org.junit.jupiter.api.Disabled;
39-
import org.junit.jupiter.api.Test;
40+
import org.junit.jupiter.api.RepeatedTest;
4041
import org.slf4j.Logger;
4142
import org.slf4j.LoggerFactory;
4243

@@ -76,6 +77,7 @@ public abstract class SailConcurrencyTest {
7677

7778
@BeforeEach
7879
public void setUp() {
80+
Properties.setLockTrackingEnabled(true);
7981
store = createSail();
8082
store.init();
8183
vf = store.getValueFactory();
@@ -154,7 +156,8 @@ public int getSize() {
154156
*
155157
* @see <a href="https://github.com/eclipse/rdf4j/issues/693">https://github.com/eclipse/rdf4j/issues/693</a>
156158
*/
157-
@Test
159+
// @Test
160+
@RepeatedTest(100)
158161
public void testConcurrentAddLargeTxn() throws Exception {
159162
logger.info("executing two large concurrent transactions");
160163
final CountDownLatch runnersDone = new CountDownLatch(2);
@@ -195,7 +198,7 @@ public void testConcurrentAddLargeTxn() throws Exception {
195198
* Verifies that two large concurrent transactions in separate contexts do not cause inconsistencies or errors when
196199
* one of the transactions rolls back at the end.
197200
*/
198-
@Test
201+
@RepeatedTest(100)
199202
public void testConcurrentAddLargeTxnRollback() throws Exception {
200203
logger.info("executing two large concurrent transactions");
201204
final CountDownLatch runnersDone = new CountDownLatch(2);
@@ -236,7 +239,7 @@ public void testConcurrentAddLargeTxnRollback() throws Exception {
236239

237240
}
238241

239-
@Test
242+
@RepeatedTest(100)
240243
@Disabled("This test takes a long time and accomplishes little extra")
241244
public void testGetContextIDs() throws Exception {
242245
// Create one thread which writes statements to the repository, on a
@@ -313,7 +316,7 @@ public void testGetContextIDs() throws Exception {
313316
}
314317
}
315318

316-
@Test
319+
@RepeatedTest(100)
317320
public void testConcurrentConnectionsShutdown() throws InterruptedException {
318321
if (store instanceof AbstractSail) {
319322
((AbstractSail) store).setConnectionTimeOut(200);
@@ -356,8 +359,8 @@ public void testConcurrentConnectionsShutdown() throws InterruptedException {
356359

357360
}
358361

359-
// @Disabled
360-
@Test
362+
// @Disabled
363+
@RepeatedTest(100)
361364
public void testSerialThreads() throws InterruptedException {
362365
if (store instanceof AbstractSail) {
363366
((AbstractSail) store).setConnectionTimeOut(200);
@@ -437,7 +440,7 @@ public void testSerialThreads() throws InterruptedException {
437440

438441
}
439442

440-
@Test
443+
@RepeatedTest(100)
441444
public void testConcurrentConnectionsShutdownReadCommitted() throws InterruptedException {
442445
if (store instanceof AbstractSail) {
443446
((AbstractSail) store).setConnectionTimeOut(200);
@@ -492,7 +495,7 @@ public void testConcurrentConnectionsShutdownReadCommitted() throws InterruptedE
492495

493496
}
494497

495-
@Test
498+
@RepeatedTest(100)
496499
public void testConcurrentConnectionsShutdownAndClose() throws InterruptedException {
497500
if (store instanceof AbstractSail) {
498501
((AbstractSail) store).setConnectionTimeOut(200);
@@ -537,13 +540,24 @@ public void testConcurrentConnectionsShutdownAndClose() throws InterruptedExcept
537540

538541
try {
539542
if (thread2.isAlive()) {
543+
// try {
540544
connection2.get().close();
545+
546+
// }finally {
541547
connection1.get().close();
548+
549+
// }
542550
} else {
551+
// try {
543552
connection1.get().close();
553+
554+
// }finally {
544555
connection2.get().close();
556+
557+
// }
545558
}
546-
} catch (SailException ignored) {
559+
} catch (Throwable logged) {
560+
logger.error("Error closing connection", logged);
547561
}
548562

549563
try (SailConnection connection = store.getConnection()) {
@@ -567,7 +581,7 @@ public void testConcurrentConnectionsShutdownAndClose() throws InterruptedExcept
567581
store.shutDown();
568582
}
569583

570-
@Test
584+
@RepeatedTest(100)
571585
public void testConcurrentConnectionsShutdownAndCloseRollback() throws InterruptedException {
572586
if (store instanceof AbstractSail) {
573587
((AbstractSail) store).setConnectionTimeOut(200);

0 commit comments

Comments
 (0)