Skip to content

Never stop the server process from the line editor of the embedded client - #125512

Merged
alexey-milovidov merged 5 commits into
masterfrom
fix-replxx-suspend-in-embedded-client
Oct 14, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
fix-replxx-suspend-in-embedded-client

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

The embedded client (/webterminal and the SSH interface) runs replxx inside the server process. Pressing Ctrl-R and then Ctrl-Z stopped the whole server with SIGSTOP. The incremental history search in replxx handled Ctrl-Z itself with raise(SIGSTOP) and so skipped the key binding that disables suspending.

The fix goes after the root cause, which is terminal job control leaking into a process that does not own the terminal:

  • replxx (merged in Handle Ctrl-Z in incremental history search through the key binding replxx#45): Ctrl-Z in the history search now exits the search and goes back to the main loop, like the other editing keys, so it uses the key binding. suspend is the only other raise call, and it can only be reached through the binding.
  • In embedded mode, suspending is always disabled, whatever ignore_shell_suspend is set to.
  • In embedded mode, the process-wide SIGWINCH handler is no longer installed. The pseudoterminal is not the server's controlling terminal, so the signal never arrives anyway, and a session must not change the server's signal handlers.

The contrib/replxx submodule points to ClickHouse/replxx@00cd994: the replxx commit already used on master plus only the one-file fix for Ctrl-Z in the history search. The broader update to the merge with replxx master (ClickHouse/replxx#46) is left for a separate PR, because its Esc-delay handling breaks Meta+Up history recall.

I confirmed locally that with only the ReplxxLineReader change (old replxx), the server ends up in state T (stopped) after \x12\x1a. With the replxx change it keeps serving, and the session still runs queries. The added integration test reuses the existing test_webterminal cluster.

Closes: https://github.com/ClickHouse/clickhouse-private/issues/80920
Related: ClickHouse/replxx#45
Related: ClickHouse/replxx#46

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed an issue where pressing Ctrl-R and then Ctrl-Z in the web terminal or the SSH interface suspended the whole server process.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/125512]

Version info

  • Merged into: 26.10.1.2405-master (included in 26.10 and later)
  • Backported to: 26.9.20.11, 26.8.28.10, 26.7.32.5, 26.3.53.6

…ient

The embedded client (`/webterminal` and the SSH interface) runs `replxx` inside
the server process. Pressing Ctrl-R and then Ctrl-Z stopped the whole server
with `SIGSTOP`: the incremental history search of `replxx` handled Ctrl-Z by
itself with `raise(SIGSTOP)`, bypassing the key binding that disables suspending.

- Update `replxx` so that Ctrl-Z in the history search goes through the key binding.
- In the embedded mode, always disable suspending, regardless of `ignore_shell_suspend`.
- In the embedded mode, do not install the process-wide `SIGWINCH` handler: the
  pseudoterminal is not the controlling terminal of the server, so it is useless,
  and the server process must not have its signal handlers changed by a session.

Closes: ClickHouse/clickhouse-private#80920

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bc33b3d]

Summary: ✅


AI Review

Summary

Reviewed #125512 at bc33b3d3974c49d8911f7094f1cc157a77bc9ac0. The PR prevents Ctrl-R followed by Ctrl-Z from suspending the server through the embedded web or SSH client, makes suspension unconditionally disabled in embedded mode, and avoids installing a process-wide SIGWINCH handler from those sessions. The earlier finding about the broader replxx upgrade is addressed by retaining only the focused history-search fix. No unresolved findings remain.

Final Verdict

✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default submodule changed At least one submodule changed in this PR. labels Oct 12, 2026
@alexey-milovidov alexey-milovidov added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Oct 12, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-cli clickhouse-client (interactive CLI) and client library. label Oct 12, 2026
`master` of `replxx` now contains the fix of Ctrl-Z in the incremental history
search. 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#45
Related: ClickHouse/replxx#46

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread contrib/replxx Resolved
@clickhouse-gh

clickhouse-gh Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit bc33b3d3974c49d8911f7094f1cc157a77bc9ac0 was not compared: the CI logs cluster did not answer (every POST attempt failed with an exception).

See the job log for details.

alexey-milovidov and others added 3 commits October 13, 2026 15:55
Address review: the previous bump to the merge of `replxx` `master` with
the ClickHouse changes also pulled in the `vi`/editing-mode series, the
`Esc`-delay handling, prompt indentation and thread-local terminal state.
The `Esc`-delay handling broke Meta+Up history recall, which made
`04909_client_hints_history_navigation` fail (`meta_up_recall_no_hints`)
in every stateless test job:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125512&sha=latest&name_0=PR
#125512

Go back to `00cd994`, which is the current `replxx` pointer on `master`
plus only the one-file fix for `Ctrl-Z` in the incremental history search.
The broader `replxx` upgrade should go into a separate PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in-embedded-client

Resolve the conflict in `tests/integration/test_webterminal/test.py` by keeping both new tests.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Oct 14, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 14, 2026
Merged via the queue into master with commit cac840b Oct 14, 2026
178 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-replxx-suspend-in-embedded-client branch October 14, 2026 20:40
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 14, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 14, 2026
clickhouse-gh Bot added a commit that referenced this pull request Oct 14, 2026
Backport #125512 to 26.8: Never stop the server process from the line editor of the embedded client
clickhouse-gh Bot added a commit that referenced this pull request Oct 14, 2026
Backport #125512 to 26.9: Never stop the server process from the line editor of the embedded client
robot-clickhouse-ci-1 added a commit that referenced this pull request Oct 15, 2026
Cherry pick #125512 to 26.3: Never stop the server process from the line editor of the embedded client
robot-clickhouse added a commit that referenced this pull request Oct 15, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request Oct 15, 2026
Cherry pick #125512 to 26.7: Never stop the server process from the line editor of the embedded client
robot-clickhouse added a commit that referenced this pull request Oct 15, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 15, 2026
strtgbb pushed a commit to Altinity/ClickHouse that referenced this pull request Oct 15, 2026
…m the line editor of the embedded client
clickhouse-gh Bot added a commit that referenced this pull request Oct 15, 2026
Backport #125512 to 26.7: Never stop the server process from the line editor of the embedded client
alexey-milovidov added a commit that referenced this pull request Oct 15, 2026
Backport #125512 to 26.3: Never stop the server process from the line editor of the embedded client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-cli clickhouse-client (interactive CLI) and client library. pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants