-
Notifications
You must be signed in to change notification settings - Fork 172
GH-5347 make the ShaclSail more robust during shutdown() #5348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
TODO
|
856e399
to
f65873b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Enhance SHACL Sail shutdown robustness by adding interruption checks, tracking and cancelling in-progress validation tasks, and improving resource cleanup.
- Added thread-interruption guards across plan nodes and iterators to abort validation on shutdown
- Tracked and cancelled in-flight validation futures and shape validation containers in ShaclSailConnection
- Improved shutdown logic in ShaclSail, AbstractSailConnection, and AbstractSail to avoid resource leaks and hanging threads
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
ShutdownDuringValidationTest.java | New parameterized tests for concurrent shutdown during validation |
PrepareCommitTest.java | New tests for shutdown timing around prepare and commit |
ConnectionsGroup.java | Catch UncheckedExecutionException when loading cache entries |
ValidationResultIterator.java | Interrupt check in tuple iteration loop |
ValidationTuple.java | Interrupt check in comparison methods |
UnionNode.java | Early exit on interrupt and closed state |
Sort.java | Added interrupt/closed checks and iterator cleanup |
Select.java | Added interrupt close handling, cleaned up bindingSet |
SparqlQueryParserCache.java | Unified exception catch, added logging for parse errors |
ShapeValidationContainer.java | Track and force-close active ValidationResultIterator |
ShaclValidator.java | Interruption check before building lazy report |
ShaclSailConnection.java | Track and cancel validation futures; shutdown guards |
ShaclSail.java | Executor shutdown improvements and isShutdown check |
DelegatingSailSource.java | Null delegate guard |
AbstractSailConnection.java | Adjusted close sequence and active-iteration tracking |
AbstractSail.java | Interrupt and close active connections on shutdown |
LookAheadIteration.java | Log and swallow stray NoSuchElementException in hasNext |
FilterIteration.java | Interrupt guard in findNextElement |
Comments suppressed due to low confidence (3)
core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShutdownDuringValidationTest.java:59
- The error message references
benchmarkFiles/datagovbe-valid.ttl
but the resource path iscomplexBenchmark/datagovbe-valid.ttl
; please correct the path in the message.
throw new RuntimeException("Could not load file: benchmarkFiles/datagovbe-valid.ttl", e);
core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/SparqlQueryParserCache.java:58
- The
logger
identifier is not defined in this class, leading to a compile error. You should add aprivate static final Logger logger = LoggerFactory.getLogger(SparqlQueryParserCache.class);
declaration or use an existing logger.
logger.error("Error parsing query: \n{}", query, cause);
core/sail/shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/Sort.java
Outdated
Show resolved
Hide resolved
core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/DelegatingSailSource.java
Outdated
Show resolved
Hide resolved
Thread.currentThread().interrupt(); | ||
} | ||
|
||
public InterruptedSailException() { | ||
super(); | ||
Thread.currentThread().interrupt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The exception constructor is modifying the thread's interrupt flag as a side effect, which is unexpected. It's better to let callers decide when to interrupt the thread.
Thread.currentThread().interrupt(); | |
} | |
public InterruptedSailException() { | |
super(); | |
Thread.currentThread().interrupt(); | |
} | |
public InterruptedSailException() { | |
super(); |
Copilot uses AI. Check for mistakes.
// try { | ||
return bindingSet.hasNext(); | ||
// } catch (NoSuchElementException e) { | ||
// // This can happen if the connection is closed while we are iterating. | ||
// // In that case, we just return false. | ||
// return false; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Commented-out code remains in localHasNext
. Please remove dead code or restore proper exception handling.
// try { | |
return bindingSet.hasNext(); | |
// } catch (NoSuchElementException e) { | |
// // This can happen if the connection is closed while we are iterating. | |
// // In that case, we just return false. | |
// return false; | |
// } | |
try { | |
return bindingSet.hasNext(); | |
} catch (NoSuchElementException e) { | |
// This can happen if the connection is closed while we are iterating. | |
// In that case, we just return false. | |
return false; | |
} |
Copilot uses AI. Check for mistakes.
GitHub issue resolved: #5347
Briefly describe the changes proposed in this PR:
PR Author Checklist (see the contributor guidelines for more details):
mvn process-resources
to format from the command line)