Do not enforce API processing timeout for parallel routing #5114
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.
Summary
As reported in #5110, deadlocks can occur when the parallel routing feature is activated. This is a regression caused by #5047:
To propagate the timeout to other threads, the initial ForkJoinPool/CompletableFuture logic used in parallel routing has been replaced by a fixed thread pool, because ForkJoinPool does not propagate interruptions.
But the work-stealing properties of the ForkJoinPool are necessary to prevent deadlocks.
This PR reverts to a ForkJoinPool implementation for the parallel routing use case.
This change does not impact API processing timeout when parallel routing is not in use.
Note: The parallel heuristic feature does not trigger deadlocks since it uses its own thread pool and does not create sub-tasks.
OpenTripPlanner/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java
Line 169 in 9eb6235
Issue
closes #5110
Unit tests
✅
Documentation
Updated documentation