[
https://issues.apache.org/jira/browse/SOLR-17983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18044775#comment-18044775
]
ASF subversion and git services commented on SOLR-17983:
--------------------------------------------------------
Commit 7e7c9cf92e5f48780c6bf6f908816f99a0b32b75 in solr's branch
refs/heads/main from Mark Robert Miller
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=7e7c9cf92e5 ]
SOLR-17983: Ensure ParallelHttpShardHandler records submit failures (#3843)
> ParallelHttpShardHandler misuses Java future APIs, causing distributed
> requests to hang indefinitely.
> -----------------------------------------------------------------------------------------------------
>
> Key: SOLR-17983
> URL: https://issues.apache.org/jira/browse/SOLR-17983
> Project: Solr
> Issue Type: Bug
> Reporter: Mark Robert Miller
> Assignee: Mark Robert Miller
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> ParallelHttpShardHandler incorrectly composes FutureTask with
> CompletableFuture, resulting in lost exceptions and hanging distributed
> requests.
>
> During shard submission, {{ParallelHttpShardHandler}} wraps each
> {{makeShardRequest}} invocation inside a {{{}FutureTask{}}}, and then runs
> that task via {{{}CompletableFuture.runAsync{}}}. The intent is to submit
> shard requests asynchronously and record their completion or failure using a
> {{whenComplete}} handler.
> However, {{FutureTask.run()}} *captures exceptions internally* rather than
> throwing them. When it’s executed inside {{{}CompletableFuture.runAsync{}}},
> the enclosing {{CompletableFuture}} cannot detect that a failure occurred,
> because {{runAsync}} only completes exceptionally when the submitted
> {{Runnable}} throws.
> As a result, if {{super.makeShardRequest(...)}} throws an exception:
> * The {{FutureTask}} records the exception internally.
> * The {{CompletableFuture}} completes _successfully_ (no exception
> propagated).
> * The {{whenComplete}} callback receives a {{null}} {{{}Throwable{}}}, so
> the error handler ({{{}recordShardSubmitError{}}}) is never called.
> * The shard response is never recorded.
> * The coordinating request waits indefinitely for a shard response that will
> never arrive.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]