Do not attempt to read from read buffer if client disconnects during fuzzing#100732
Closed
antaljanosbenjamin wants to merge 2 commits intomasterfrom
Closed
Do not attempt to read from read buffer if client disconnects during fuzzing#100732antaljanosbenjamin wants to merge 2 commits intomasterfrom
antaljanosbenjamin wants to merge 2 commits intomasterfrom
Conversation
…fuzzing Some info about what went wrong: Root cause: The AST fuzzer (executeASTFuzzerQueries) runs fuzzed internal queries after the original query completes (via onFinish() callback). These internal queries inherit the outer query's InteractiveCancelCallback through CurrentThread::tryGetQueryContext(). When JoinOrderOptimizer::checkLimits() invokes this callback, it calls receivePacketsExpectCancel() which reads from the TCP input buffer in. If the client has disconnected, in gets canceled. The fuzzer's catch(...) swallows the exception and continues. When the fuzzer finishes and the TCPHandler loop calls in->eof(), the chassert(!isCanceled()) in ReadBuffer::next() fires.
Contributor
|
Workflow [PR], commit [68d3e4d] Summary: ❌
AI ReviewSummaryThis PR fixes a real cancellation-path issue during AST fuzzing: fuzzed internal queries inherited an interactive cancel callback tied to the client connection, which could cancel the input buffer and later trigger an exception when Missing context
ClickHouse Rules
Final Verdict
|
Member
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 100.00% (15/15, 0 noise lines excluded) |
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.
Some info about what went wrong:
Root cause: The AST fuzzer (
executeASTFuzzerQueries) runs fuzzed internal queries after the original query completes (viaonFinish()callback). These internal queries inherit the outer query'sInteractiveCancelCallbackthroughCurrentThread::tryGetQueryContext(). WhenJoinOrderOptimizer::checkLimits()invokes this callback, it callsreceivePacketsExpectCancel()which reads from the TCP input buffer in. If the client has disconnected, in gets canceled. The fuzzer'scatch(...)swallows the exception and continues. When the fuzzer finishes and theTCPHandlerloop callsin->eof(), thechassert(!isCanceled())inReadBuffer::next()fires.Changelog category (leave one):
Documentation entry for user-facing changes