eclipse-rdf4j / rdf4j

Eclipse RDF4J: scalable RDF for Java
https://rdf4j.org/
BSD 3-Clause "New" or "Revised" License
364 stars 164 forks source link

MediumConcurrencyTest should not be flaky #4434

Open erikgb opened 1 year ago

erikgb commented 1 year ago

Example: https://github.com/eclipse/rdf4j/actions/runs/4194448129/jobs/7272627465

I have also seen this failing other PRs for totally unrelated changes.

Here is the failing test stacktrace - in case GH workflow logs are subject to retention:

Error:  Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.312 s <<< FAILURE! - in org.eclipse.rdf4j.federated.MediumConcurrencyTest
Error:  org.eclipse.rdf4j.federated.MediumConcurrencyTest.queryMix  Time elapsed: 1.269 s  <<< ERROR!
java.util.concurrent.ExecutionException: org.eclipse.rdf4j.sail.SailException: Connection closed before all iterations were closed.
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
    at org.eclipse.rdf4j.federated.MediumConcurrencyTest.lambda$queryMix$0(MediumConcurrencyTest.java:69)
    at org.junit.jupiter.api.AssertTimeout.lambda$assertTimeoutPreemptively$4(AssertTimeout.java:138)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: org.eclipse.rdf4j.sail.SailException: Connection closed before all iterations were closed.
    at org.eclipse.rdf4j.sail.helpers.AbstractSailConnection.close(AbstractSailConnection.java:287)
    at org.eclipse.rdf4j.repository.sail.SailRepositoryConnection.close(SailRepositoryConnection.java:248)
    at org.eclipse.rdf4j.federated.evaluation.iterator.CloseDependentConnectionIteration.handleClose(CloseDependentConnectionIteration.java:77)
    at org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration.close(AbstractCloseableIteration.java:52)
    at org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelTaskBase.close(ParallelTaskBase.java:117)
    at org.eclipse.rdf4j.federated.structures.QueryInfo.closeScheduledTasks(QueryInfo.java:260)
    at org.eclipse.rdf4j.federated.structures.QueryInfo.close(QueryInfo.java:223)
    at org.eclipse.rdf4j.federated.evaluation.iterator.StopRemainingExecutionsOnCloseIteration.handleClose(StopRemainingExecutionsOnCloseIteration.java:70)
    at org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration.close(AbstractCloseableIteration.java:52)
    at org.eclipse.rdf4j.common.iteration.Iterations.closeCloseable(Iterations.java:189)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.handleClose(IterationWrapper.java:127)
    at org.eclipse.rdf4j.sail.helpers.SailBaseIteration.handleClose(SailBaseIteration.java:55)
    at org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration.close(AbstractCloseableIteration.java:52)
    at org.eclipse.rdf4j.common.iteration.Iterations.closeCloseable(Iterations.java:189)
    at org.eclipse.rdf4j.common.iteration.IterationWrapper.handleClose(IterationWrapper.java:127)
    at org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration.close(AbstractCloseableIteration.java:52)
    at org.eclipse.rdf4j.federated.FedXBaseTest.execute(FedXBaseTest.java:99)
    at org.eclipse.rdf4j.federated.MediumConcurrencyTest.lambda$submit$2(MediumConcurrencyTest.java:85)
    ... 4 more
erikgb commented 1 year ago

Seems related to #3317.

hmottestad commented 1 year ago

Related to: https://github.com/eclipse/rdf4j/issues/4242 and https://github.com/eclipse/rdf4j/issues/4068

hmottestad commented 1 year ago

This is a bug in the federation module where at some point a connection is closed before all open iterations are closed. I've fixed a number of these bugs already and I was really hoping that I can caught everything. The bugs are quite hard to find and fix.