{{ message }}
Abort on std::logic_error in CI#51907
Merged
Merged
Conversation
Contributor
Member
Author
|
AST fuzzer (asan) — Logical error: 'std::exception. Code: 1001, type: std::__1::future_error, e.what() = The associated promise has been destructed prior to ... |
Member
Author
|
Integration tests (asan, analyzer) [1/6] - |
antonio2368
reviewed
Oct 12, 2023
Member
There was a problem hiding this comment.
Did you mean
if (with_stacktrace)
Member
Author
There was a problem hiding this comment.
No, if with_stacktrace is true, then we already have the stacktrace printed to stream. And we need to print it if it's false
pull Bot
pushed a commit
to AKJUS/ClickHouse
that referenced
this pull request
Jun 25, 2026
In Coordination::ZooKeeper::sendThread, after a request is popped from the queue the local RequestInfo is the sole owner of its callback until the request is inserted into operations (from which receiveEvent()/finalize() later satisfy it). Async callers such as ZooKeeper::asyncTryExistsNoThrow capture a shared_ptr<std::promise<...>> in that callback and hand the std::future to a waiting caller before the request is processed. If anything in the pop->insert window throws (the OpenTelemetry span finalize, addRootPath, or the operations map insert, all of which can allocate and throw under memory pressure), the local RequestInfo is destroyed while unwinding and the callback never runs. The captured std::promise is then destroyed unsatisfied, so the waiter's future.get() observes a std::future_error (broken promise). That future_error is a std::logic_error, which the server reports as a LOGICAL_ERROR and aborts on (see PR ClickHouse#51907). This matches the reported crash (STID 2508-34fb, ZooKeeper-client variant): ~promise<ExistsResponse> running from sendThread's teardown. Arm a SCOPE_EXIT guard over that window: if the request is dropped before its callback ownership transfers to operations, satisfy the callback with an error response (ZCONNECTIONLOSS if it was probably sent, otherwise ZSESSIONEXPIRED) instead of abandoning the promise. This mirrors how finalize() drains outstanding operations and the already-merged sibling fixes for the same error class (TestKeeper, PR ClickHouse#73570; the thread-pool callback runner, PR ClickHouse#107383). The fix is at the send layer, so it covers every async request type uniformly. Add a unit test reproducing the window contract: without the guard the future carries a broken-promise future_error; with the guard it carries a normal ZSESSIONEXPIRED response and nothing aborts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Changelog category (leave one):
Usually
std::logic_errorindicates a bug, just like ourLOGICAL_ERROR.See also #51135