Repository navigation
Conversation
…d of losing them LoaderMain runs the node table and each index on worker threads. A failure there never reached the caller: Indexer.stageIndex and DataToTuples.action caught the exception, logged it, aborted and still released their termination permit, so finishBulk() either returned normally with an index left empty or, once the failed stage stopped consuming its bounded queue, blocked for good. An Error killed the thread without releasing the permit. Indexer and DataToTuples now catch Throwable, record the first failure and rethrow it from finishBulk() as BulkLoaderException. After a failure they keep the pipeline moving: an indexer drains its queue up to the end marker, DataToTuples drains its input and still sends the end markers downstream. The termination permit is released in a finally block. BulkProcesses.finish waits for every process even if one fails, so no worker is still running when the caller releases the exclusive mode in finishException(). LoaderMain.indexPhase ends its read transaction if the replay fails. TestLoaderMainFailures covers each case; against the previous code three of them hang, one returns normally with an index left empty, and one shows BulkProcesses.finish stopping at the first failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EroWQGu7H82ioAbCdFfXpP
scthi
marked this pull request as ready for review
November 23, 2026 09:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub issue resolved #4442
Pull request Description:
LoaderMain(thelight,phasedandparallelloader plans,tdb2.tdbloader --loader=phased|parallel|light) runs the node table and each index on worker threads. A failure on one of them never reaches the caller:Indexer.stageIndexcatches the exception, logs it, aborts and still releases its termination permit. If the failure comes after the producer has delivered everything,finishBulk()returns normally and the database is left with that index empty while the others are complete.put()for good,DataToTuplesnever sends its end markers, andfinishBulk()hangs.DataToTuples.actionhas the same pattern: a node-table failure is either lost or leaves the indexers waiting for end markers.Error(e.g.OutOfMemoryError) kills the thread without releasing the permit, sofinishBulk()waits forever.Changes:
IndexerandDataToTuplescatchThrowable, record the first failure and rethrow it fromfinishBulk()asBulkLoaderException. Callers already handle that throughfinishException(), which releasesLoaderMain's exclusive mode.DataToTuplesdrains its input and still sends the end markers downstream. Neither drains past an end marker it has already seen, so a failure in the final commit cannot hang either.finallyblock.BulkProcesses.finishwaits for every process even if one fails (first failure rethrown, later ones suppressed), so no worker is still running when the exclusive mode is released.LoaderMain.indexPhaseends its read transaction if the replay fails.Tests:
TestLoaderMainFailures(added toTS_Loader) injects failures into an index (on the first tuple, on the last tuple, anError) and into aDataToTuplesdestination, and checksBulkProcesses.finish. Against the previous code, three of them hang (stopped by a 30 s timeout), one returns normally with an index left empty, and one showsBulkProcesses.finishstopping at the first failure. With the change all pass, as doTestLoaderMainPlanandTestLoaderStdSetups.Not addressed: a running bulk load still cannot be cancelled from outside (e.g. on a deadline). A
DataLoader.abort()that interrupts the worker threads could be a follow-up.By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.
See the Apache Jena "Contributing" guide.