Repository navigation
Cherry pick #125510 to 26.3: Do not share line editor state between concurrent embedded client sessions - #127884
Merged
robot-ch-test-poll2 merged 18 commits intoOct 27, 2026
Merged
Conversation
…sions Client sessions embedded into the server (the web terminal and SSH) run concurrently in one process, but the line editor kept some of its state in process-wide variables: - `replxx_last_is_delimiter` in `ReplxxLineReader.cpp`, which decides whether Enter commits the query in multiline mode. It is now a member of `ReplxxLineReader`, reported by the highlighter callback. - In replxx: the receiver of `SIGWINCH`, the partially read UTF-8 sequence in `read_unicode_character` (concurrent multi-byte input could corrupt each other, and a race allowed a one-byte out-of-bounds write), the modifiers of the escape sequence being parsed, and the buffer of `ansi_color`. An embedded client no longer installs the `SIGWINCH` handler in the server process: its terminal size is updated by the server, and replxx queries it on every refresh. Related: ClickHouse/clickhouse-private#80922 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`master` of `replxx` now contains the fix of the shared terminal state. The new commit merges it with the history recall changes used by ClickHouse and fixes Ctrl-V blocking after the esc delay support from `master`. Related: ClickHouse/replxx#44 Related: ClickHouse/replxx#46 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous `replxx` commit had a regression from the esc delay support in `replxx` `master`: Meta with escape sequences (e.g. Meta+Up) was not recognized, and `04909_client_hints_history_navigation` (`meta_up_recall_no_hints`) failed in every stateless test job: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125510&sha=33773832dc78e5a5e773171f8b489ca21d9bd77a&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29 #125510 The new commit is current `replxx` `master` (which also has the UTF-8 decoder state kept per `Terminal` from ClickHouse/replxx#47) plus the fix. Related: ClickHouse/replxx#48 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The same tree as the previous `replxx` commit, now merged into `replxx` `master` via ClickHouse/replxx#48. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dth on refresh Address review: `read_unicode_character` decoded an uninitialized byte when `poll` reported only `POLLHUP`/`POLLERR`/`POLLNVAL`, and the embedded client, which does not install the `SIGWINCH` handler, kept rendering against the startup width after a resize. Both are fixed in ClickHouse/replxx#49. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: - `contrib/replxx`: kept the pointer of this PR (`33a566d`). It already contains the `Ctrl-Z` fix in incremental history search that `master` points to (`00cd994`, merged into `replxx` `master` as `91703bf`), together with the Meta+Up fix, the thread-local decoder state, and the hangup and terminal width fixes this PR needs. - `src/Client/ReplxxLineReader.cpp`: kept the comment of this PR about `SIGWINCH`, which matches re-reading the terminal width on every refresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ClickHouse/replxx#49 is merged into `replxx` `master`. The merge commit also contains the `Ctrl-Z` fix for the incremental history search that `master` points to (ClickHouse/replxx#45) and the history search cursor fix (ClickHouse/replxx#50). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict in `src/Client/ReplxxLineReader.cpp`: master made `replxx_last_is_delimiter` thread-local; this PR replaces it with the `last_is_delimiter` member reported by the highlighter callback, so the thread-local variable and `setLastIsDelimiter` are dropped.
Two web terminal sessions receive their queries byte by byte, interleaved, with multi-byte UTF-8 characters split between the sessions, and each session must decode its own query. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-state Do not share line editor state between concurrent embedded client sessions
…e conflicts Adapt the change to the 26.3 API: `highlight` there has no `rainbow_parentheses` and `lexer_fallback` parameters, so only the new `last_is_delimiter` parameter is added, and the Enter handler keeps its 26.3 condition with the global flag replaced by the `ReplxxLineReader` member. The `SIGWINCH` comment is kept as in 26.3. The test `05445_webterminal_concurrent_sessions_input` is dropped: 26.3 has no `/webterminal` endpoint. The fix still matters there for concurrent SSH sessions embedded into the server, which shared the non-thread-local global flag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Original pull-request #125510
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job