Repository navigation
Apply the session limits of other interfaces to the web terminal - #125514
Conversation
A web terminal session holds a server thread, a thread for the embedded client, and a pseudoterminal, but previously it never expired and `max_sessions_for_user` was checked only asynchronously in the client thread. Now the session context is created in `WebTerminalRequestHandler` before the pseudoterminal and the client thread are allocated, so a session over `max_sessions_for_user` is rejected with the close code `1008`. The session is closed after `idle_connection_timeout` seconds without traffic, as in `TCPHandler`, and the socket timeouts use the user's `receive_timeout` and `send_timeout` instead of hardcoded values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [aa63247] Summary: ✅
AI ReviewSummaryThe PR applies authenticated users' session and socket limits to Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; current-head CI remains pending. |
…uery in the web terminal `TCPHandler` applies `idle_connection_timeout` only while waiting for the next query, so a long silent query over the native protocol is not interrupted. The web terminal now does the same: the idle timer runs only while the embedded client waits at the prompt. `ClientBase::runInteractive` sets a flag provided by `ClientEmbeddedRunner` around reading the query. The test checks that a query longer than `idle_connection_timeout` completes and that the session is closed after it becomes idle again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125514&sha=78d1e9965059e88fefe5575e0677428c6d85acff&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%201%2F4%29 ( The TSan data race on |
|
The The error ( On master since the merge: 117 OK, 1 FAIL, and that failure ( |
…of timeouts in the web terminal A zero `receive_timeout` now disables the per-frame deadline instead of making every frame read time out immediately, as for other interfaces. `receive_timeout`, `send_timeout` and `idle_connection_timeout` are re-read from the session context whenever the embedded client returns to the prompt, as `TCPHandler` re-reads them after each query, so a `SET` typed in the terminal takes effect. The embedded client reports prompt entries through a callback, and the runner counts them, so that a short query finishing between two iterations of the handler loop is not missed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125514&sha=891ecb8c33a683661d76af3fe7381895c2577db3&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 ( The TSan data race on |
|
This is #112642, fixed by #123121 (merged 2026-10-13 22:15Z; its description names this test). The failing job built |
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125514&sha=fb34b5d8432f91ec51c731e4efa9f64aabcc96fd&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%2C%20old_compatibility%29 ( The other failures of this run are not related either:
|
|
This is the bug my open #121688 fixes. The shard-local re-analysis of the Measured with this query (
So no separate PR is needed. #121688 is waiting for a re-review after the requested topological-sort change. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units23 translation units recompiled, 134 s compile time in total, 23 of them have a recent master baseline. |
`ProgressIndication::writeProgress` kept the frame of the spinning indicator in a function-local `static`, which is shared by all clients in the process. Concurrent sessions of the web terminal (embedded clients) increment it from several threads, which TSan reports as a data race. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125514&sha=c65e37be6033d108fd90297dd81f761c23a15cad&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20targeted%29 #125514 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Thanks @groeneai, #121688 tracks the The latest TSan run ( |
The embedded client repaints the progress indicator on every progress and profile events packet, sent every `interactive_delay` (100 ms by default), so the terminal output alone kept the session alive and the case passed even without the `isWaitingForQueryInput` guard. A query-local `interactive_delay` longer than the query makes it silent. Verified locally: the case fails without the guard and passes with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged master (
|
|
The fix is my open #125562. It passes This run shows the same chain as the other carriers. The previous release (26.9.21.9) retried the #125562 passes its own CI but nobody has reviewed it yet. Until it is merged, this check will keep failing on unrelated PRs. |
…s all-constant The parallel final DISTINCT (ClickHouse#114550) hands its ScatterByPartitionTransform lanes downstream as separate streams, and a scatter holds its input chunk until every unfinished lane has accepted its piece, so the lanes are coupled. A full sort normally decouples them, because MergeSortingTransform consumes its whole input first. When every sort key is a constant, SortingTransform strips them all and MergeSortingTransform::consume passes chunks through, yet SortingStep::fullSort still merged the lanes with MergingSortedTransform. With all keys equal the cursor tie-break is the source number, so the merge asks for its first input only, until that input finishes. The first lane finishes only after every scatter has finished, and a scatter cannot finish while the lanes the merge does not read are full: Pipeline stuck (a logical error, so debug and sanitizer servers abort). Reachable without the fuzzer, e.g. SELECT * FROM (SELECT DISTINCT 'x' AS c, number FROM numbers_mt(100000)) ORDER BY c SETTINGS max_threads = 4, max_block_size = 100 and with a window OVER (ORDER BY <constant>). DISTINCT and ORDER BY in the same SELECT are not affected: preserveInputOrder() forbids the scatter there. An all-constant description orders nothing, so any interleaving is a valid result. fullSort now combines such streams with resize(1), whose ResizeProcessor drains whichever input is ready. This is the remedy that 5e1ec58 (ClickHouse#114626) applied to GatherSendStep for the same wedge; its helper sortDescriptionIsAllConstant moves to Core/SortDescription so both sites share it (no behaviour change in GatherSendStep). The stage grouping used by EXPLAIN PIPELINE is kept, virtual rows are still removed in the shared non-merge branch, and the top-K threshold tracker is skipped because it belongs to the merge. A limit on the sorting step is only a hint pushed down from the LimitStep that stays above it, and the single-stream path already relied on that, so LIMIT and WITH TIES stay correct. Found by AST fuzzer (amd_debug, targeted) on ClickHouse#125514 The new test fails with Pipeline stuck before this change and passes after it, also 50/50 with randomized settings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Concurrent web terminal sessions run several embedded clients in the same server process. The flag set by the highlighter and read by the Enter key handler was a process-wide `static`, so one session's highlighter raced with another session's Enter handler (TSan data race at `src/Client/ReplxxLineReader.cpp:620`). Both callbacks run on the thread of the session's input loop, so a thread-local flag keeps each session separate. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125514&sha=f9f1dce80eb9002556db97367c45bd87daf42a8c&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20flaky%20check%29 #125514 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Pushed
@groeneai, thanks. #125562 tracks the Upgrade check failure. |
…ress-indicator-frame Backport #125514 to 26.10: Make the progress indicator frame per-instance in `ProgressIndication`
…ess-indicator-frame Backport #125514 to 26.9: Make the progress indicator frame per-instance in `ProgressIndication`
…ess-indicator-frame Backport #125514 to 26.8: Make the progress indicator frame per-instance in `ProgressIndication`
`ProgressIndication::writeProgress` kept the frame of the spinning indicator in a function-local `static`, which is shared by all clients in the process. Concurrent sessions of the web terminal (embedded clients) increment it from several threads, which TSan reports as a data race. It fails every `Stress test (amd_tsan)` run since `05445_webterminal_concurrent_sessions_input` came with the backport of #125510. Backport of 3329e92 from #125514 (only this commit; the rest of the PR is a feature). https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=26.10&sha=da23b6505a74b35f9ef57cb2a3a26665db3fd763&name_0=ReleaseBranchCI #125514 (cherry picked from commit 3329e92) Co-Authored-By: Claude Opus 5.5 <[email protected]>
`ProgressIndication::writeProgress` kept the frame of the spinning indicator in a function-local `static`, which is shared by all clients in the process. Concurrent sessions of the web terminal (embedded clients) increment it from several threads, which TSan reports as a data race. It fails every `Stress test (amd_tsan)` run since `05445_webterminal_concurrent_sessions_input` came with the backport of #125510. Backport of 3329e92 from #125514 (only this commit; the rest of the PR is a feature). https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=26.10&sha=da23b6505a74b35f9ef57cb2a3a26665db3fd763&name_0=ReleaseBranchCI #125514 (cherry picked from commit 3329e92) Co-Authored-By: Claude Opus 5.5 <[email protected]>
`ProgressIndication::writeProgress` kept the frame of the spinning indicator in a function-local `static`, which is shared by all clients in the process. Concurrent sessions of the web terminal (embedded clients) increment it from several threads, which TSan reports as a data race. It fails every `Stress test (amd_tsan)` run since `05445_webterminal_concurrent_sessions_input` came with the backport of #125510. Backport of 3329e92 from #125514 (only this commit; the rest of the PR is a feature). https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=26.10&sha=da23b6505a74b35f9ef57cb2a3a26665db3fd763&name_0=ReleaseBranchCI #125514 (cherry picked from commit 3329e92) Co-Authored-By: Claude Opus 5.5 <[email protected]>
A
/webterminalsession holds a server thread, a thread for the embeddedclickhouse-client, and a pseudoterminal. Before this change it never expired, andmax_sessions_for_userwas only checked asynchronously in the embedded client thread, after the pseudoterminal and the thread had been allocated.This change applies the same limits that other interfaces use, taken from the settings of the authenticated user:
WebTerminalRequestHandlerright after authentication, before the pseudoterminal and the client thread are allocated. A session overmax_sessions_for_useris rejected with the WebSocket close code1008.idle_connection_timeoutseconds without traffic in either direction while the embedded client waits at the prompt, asTCPHandlerdoes for native protocol connections waiting for the next query. A running query is never interrupted by this timeout.receive_timeoutandsend_timeoutinstead of the hardcoded 30 seconds.The documentation of the web terminal gets a new section about these limits.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The web terminal (
/webterminal) now applies the same limits as other interfaces:max_sessions_for_useris checked before a session is started, an idle session is closed afteridle_connection_timeout, andreceive_timeoutandsend_timeoutare applied to the WebSocket connection.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125514]
Version info
26.11.1.566-master(included in26.11and later)