Skip to content

Web UI: fix user/password field staying red with correct credentials - #109414

Merged
alexey-milovidov merged 20 commits into
masterfrom
web-ui-fix-credential-status-race
Jul 28, 2026
Merged

alexey-milovidov merged 20 commits into
masterfrom
web-ui-fix-credential-status-race

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 4, 2026 •

Copy link
Copy Markdown
Member

In the Web UI (play.html), the user name (and password) input field often remained red even when the credentials were correct and the connection dot was green.

The connection dot (#url_status) and the field colour are driven by two independent checks: checkURL (an OPTIONS ping, which paints the dot) and checkCredentials (a POST SELECT version(), which paints the fields). checkCredentials guards its async response against check_credentials_request_num, but resetCredentialsStatus — run on every keystroke — only cleared the CSS classes without bumping that counter. So a credential check started against an earlier wrong or incomplete value could still land and paint the field red after the user had already typed the correct credentials, while the independently-driven green dot stayed green. Nothing re-checked afterwards, because typing (as opposed to paste or URL edits) never triggered a check.

This fixes the problems:

  • resetCredentialsStatus now bumps check_credentials_request_num, so any in-flight credential check is invalidated on edit and a stale response can no longer paint the field.
  • Editing a connection field now only resets the indication (no network probe), and the actual credential check runs once, when focus leaves the whole connection block (#inputs: url + user + password). This is the single commit point, so it fires no matter which field was edited or focused last — including url (a natural order is to type the credentials for a new server, then point url at it). Probing earlier would misfire while the connection is still being assembled: moving between user and password sends a mismatched half-typed pair (the new user against the old password, or vice versa); moving focus into url would send the full final password to the previous server, disclosing it there and logging a spurious failed login; and a url keystroke that happens to hit a reachable intermediate endpoint would send the credentials there. Waiting until focus leaves the whole block means only the final, complete connection tuple is sent, and the commit pings the url and only then probes the credentials, so an unreachable server leaves the fields neutral rather than blaming them. A correct value turns green and a wrong one red without an explicit action. This subsumes the old paste handlers, since a pasted value is committed by the following focus change just like typed input. Probing on every keystroke was avoided deliberately: getServerStatus puts the credentials into the request, so it would otherwise emit login attempts with partial (and, for the password, secret) prefixes.
  • checkURL no longer probes the credentials on every intermediate url keystroke — only on the initial page load and on the block-level commit — so the password is never sent to a half-typed or still-old endpoint while the URL is being edited. The invalidation also covers url edits: a URL change may point at a different server, so an in-flight credential check against the previous URL is invalidated and the stale colour cleared, preventing a response from the old endpoint from repainting the fields for the wrong server; and a url-only change is re-checked against the new server when the block is committed.

Changelog category (leave one):

  • Improvement

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

Web UI: fix the user/password input field staying red even when the credentials are correct and the server is reachable, and re-check credentials once you finish editing the connection so a correct value is confirmed with green.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

Version info

  • Merged into: 26.8.1.283 (included in 26.8 and later)

In `play.html`, the connection dot (`#url_status`) and the user/password
field colour are driven by two independent checks: `checkURL` (an `OPTIONS`
ping) and `checkCredentials` (a `POST SELECT version()`). `checkCredentials`
guards its async response against `check_credentials_request_num`, but
`resetCredentialsStatus` — run on every keystroke — only cleared the CSS
classes without bumping that counter. As a result, a check started against
an earlier wrong or incomplete value could still land and paint the field
red after the user had already typed the correct credentials, while the
independently-driven green dot stayed green. Nothing re-checked afterwards,
because typing (as opposed to paste or URL edits) never triggered a check.

Fix both problems:
- `resetCredentialsStatus` now bumps `check_credentials_request_num`, so any
  in-flight credential check is invalidated on edit and a stale response can
  no longer paint the field.
- A debounced `scheduleCredentialsCheck` re-checks credentials shortly after
  the user stops typing (or pastes), so correct credentials turn green and
  wrong ones red without an explicit action. This subsumes the old `paste`
  handlers, since a paste reaches it through the `input` event it triggers.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f80f5ee]

Summary: ✅


AI Review

Summary

This PR rewrites the Web UI credential-status flow around a single connection-surface commit, invalidates stale async probes, and extends that logic across the dropdown, page-blur, history-restore, and autofill paths. On the current head, the earlier race / premature-probe issues raised in review are addressed, and I did not find a remaining correctness or security regression in the changed paths.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jul 4, 2026
Comment thread programs/server/play.html Resolved
Comment thread programs/server/play.html Resolved
alexey-milovidov and others added 2 commits July 4, 2026 22:49
Address review feedback: the debounced `input`-driven `scheduleCredentialsCheck`
turned ordinary password typing into repeated authentication probes. Because
`getServerStatus` appends `user`/`password` to the request URL and sends
`SELECT version()`, a slow typist emitted `?password=s`, `?password=se`, ... as
separate failed logins with partial secret prefixes before the final value was
complete — polluting access logs and potentially tripping auth rate limits.

Now editing a credential field only resets the indication (clear classes and
invalidate any in-flight check via `resetCredentialsStatus`), without any network
probe. The check itself runs on `change`, i.e. when the field is committed
(typically on blur), so it uses only the final, complete value. This subsumes the
old paste handlers, since a pasted value is committed by the following blur just
like typed input, and correct credentials still turn green without an explicit
action.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address review feedback: `resetCredentialsStatus` bumped the request number only
on `user`/`password` edits, so a `url` edit left the previous credential probe
live. Concrete trace: start `checkCredentials` against server A, edit `url` to
server B; `checkURL` clears the dot and pings B but did not bump
`check_credentials_request_num`, so the old response from A could land and repaint
the auth fields for the wrong endpoint — and if B is unreachable, that stale color
would stick because no replacement `checkCredentials` runs.

Register `resetCredentialsStatus` as a `url` `input` handler too. It runs after
the existing `checkURL` handler, so a successful ping to the new URL still triggers
a fresh credential check; a failed ping now leaves the fields neutral rather than
keeping the previous server's colour.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
The previous commit ran `checkCredentials` on each field's `change` event.
But `change` fires when focus moves from `user` to `password` (or back), so
editing both fields in sequence sent a mismatched pair — the new user against
the old password, or vice versa — as an unintended login attempt before the
user had finished editing, briefly flashing red and polluting access logs.

Move the check to `focusout` on the credential fields, skipping the case where
`relatedTarget` is the sibling credential field (focus merely travelling within
the pair). A `credentials_edited` guard set on `input` ensures that merely
tabbing through the fields, without changing anything, emits no login attempt.
So `checkCredentials` runs once, on the final complete pair, when focus leaves
the credential block.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
…mmitted

The previous `focusout` guard treated the credential pair (`user`/`password`)
as the whole "finished editing" scope: it skipped the probe only when focus
moved to the sibling credential field. But the connection tuple also includes
`url`. In the natural order of setting up a new connection — type the
credentials for a new server, then point `url` at it — moving focus from
`user`/`password` into `url` counted as "finished", so `checkCredentials` fired
`getServerStatus(old_url, new_user, new_password)` against the *previous*
server. Because `getServerStatus` puts the credentials into the request URL,
this disclosed the full final password to the previous server and logged a
spurious failed login there.

Treat the whole connection block `#inputs` (url + user + password) as one edit
session: skip the probe while focus stays anywhere inside `#inputs`, and probe
only once focus leaves the block. Genuine `url` edits are already re-checked by
`checkURL`'s success path, so no coverage is lost.

Follows up the review on #109414

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default and removed pr-improvement Pull request with some product improvements labels Jul 5, 2026
Address the AI review Blocker (round 5). The round-4 wiring could still
(1) skip the credential check entirely — editing `user`/`password`, moving
into `url`, then leaving the block ran no `checkCredentials`, because only
`user`/`password` had a `focusout` handler — and (2) probe too early:
`checkURL` called `checkCredentials` on every successful `url` `input`, so
the full password could be sent to a half-typed or still-old endpoint
before the connection tuple was committed.

Treat the whole `#inputs` block (url + user + password) as one edit
session:
- a single `focusout` listener on `#inputs` (the event bubbles) is the one
  commit point; it fires when focus leaves the block from any field,
  including `url`, and runs `checkURL(true)`, so an unreachable server
  leaves the fields neutral instead of blaming them;
- `checkURL` takes a `probe_credentials` flag and probes only on the
  initial load and on that commit, never on intermediate `url` keystrokes;
- a `url` edit marks the connection edited, so committing a url-only change
  re-checks the credentials against the new server.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
Comment thread programs/server/play.html Resolved
alexey-milovidov and others added 2 commits July 5, 2026 02:05
Addresses the AI-review blocker at `programs/server/play.html:3594`.

A `checkURL(true)` ping arms a deferred `checkCredentials` on success, but the
ping is asynchronous. The initial page-load ping (or one from an earlier
commit) could resolve after the user had already resumed typing, and its
success path called `checkCredentials` against the current, still-in-progress
fields — sending `getServerStatus(url, user, "s")`, `"se"`, ... to the server.
A `user`/`password` edit only bumped `check_credentials_request_num`, which
guards the check *response*, not the ping-to-probe *chain*, so nothing stopped
that call from being made in the first place.

Add a `connection_generation` counter, bumped on every connection edit
(`url`/`user`/`password` `input`). `checkURL` captures it when the ping starts
and probes only if it is still current when the ping resolves, so any edit
made while the ping is in flight invalidates the armed probe.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Addresses the AI-review blocker at `programs/server/play.html:4386`.

The block-level `focusout` commit treated `relatedTarget === null` as "focus
left `#inputs`". But `#inputs` contains non-focusable elements — the status dot
`#url_status` and its children — and a pointer press on one of them blurs the
active field with no new focus target, i.e. `relatedTarget === null`, while the
interaction stayed inside the block. Typing credentials for a new server while
`url` still points at the old one and then clicking the status dot was therefore
treated as a commit and sent the full password to the *previous* server.

Track whether the current pointer press landed inside `#inputs` (reset on
release/cancel, so a keyboard move to nothing is unaffected) and skip the commit
for a null-`relatedTarget` blur that happened during such a press. Only a real
exit from the block now commits and probes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
The previous commit suppressed the block commit when a pointer press
landed on a non-focusable spot inside `#inputs` (the status dot or a
gap), because that blurs the active field with `relatedTarget === null`
without the user actually leaving the connection block. But suppressing
that blur is not enough on its own: the field has already lost focus, so
when the user then moves on (clicks the query editor or the `Run`
button) no second `focusout` fires and the deferred check would never
run, leaving the fields neutral forever. Concretely: edit `password`,
click `#url_status`, then click the query editor.

Remember a suppressed internal-click blur in `commit_deferred` and
commit on the first later press outside `#inputs`. A credential field
regaining focus (`focusin` inside the block) means editing resumed and
the normal `focusout` will commit, so the deferred flag is dropped then.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
@pamarcos

pamarcos commented Jul 6, 2026

Copy link
Copy Markdown
Member

Feedback from GPT-5.5:
CI is blocked by new_tests_check.py because no tests were added. Since this credential-status logic had several race-prone focus/input paths during review, please add a focused regression test or otherwise provide sufficient test coverage/manual evidence acceptable to CI. The cached amd_release artifact exists, but source acceptance should wait for the test-policy issue to be resolved.

@pamarcos pamarcos self-assigned this Jul 6, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Web UI does not have tests for now, it's okay.

@pamarcos pamarcos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I couldn't fully reproduce the issue where the credentials textedits remained red in master, but the new version doesn't have that.

Before

With wrong password
Image

With right password
Image

After

With wrong password
Image

With right password
Image

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements and removed pr-bugfix Pull request with bugfix, not backported by default labels Jul 12, 2026
Comment thread programs/server/play.html Resolved
Comment thread programs/server/play.html Resolved
After merging master, the connection inputs can be relocated behind the
🔑 button into a drop-down (`#connection-menu`); the credential re-check
boundary only treated `#inputs` as the edit session, which broke down in
that layout. Address two review findings from the interaction:

- Moving focus from `user`/`password` to the 🔑 button — clicking it to
  close the drop-down, or `Escape` (whose close path refocuses it) —
  counted as "finished editing" and ran `checkURL(true)`, probing the
  *old* url with the new password via `getServerStatus`. That is exactly
  the premature-probe / password-disclosure this fix is meant to prevent.
  The edit surface is now resolved by `connectionSurface`: the whole
  `#connection-menu` while the inputs live in the drop-down, and `#inputs`
  inline. Focus staying anywhere in the connection UI keeps the session
  open; only leaving it commits.

- The commit decision now reads the settled `document.activeElement` on
  the next microtask instead of the `focusout` `relatedTarget`, which is a
  transient intermediate value while the drop-down hides the focused field
  before handing focus to the 🔑 button.

- The deferred commit (set after an internal-click blur onto the status
  dot) now also flushes on a `focusin` outside the surface (a keyboard
  `Tab` away) and on the drop-down closing, not only on a later pointer
  press, so keyboard users who press `Escape`/`Tab` no longer leave the
  auth fields neutral forever.

Both issues were flagged by the automated review on the merge commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread programs/server/play.html Resolved
Losing focus to the browser itself (address bar, another window) blurred
the field to `<body>` with no pointer press inside the surface, so the
`focusout` microtask fell through to `commitConnection` and could send a
freshly typed password to the previous server. Detect page blur via
`document.hasFocus` and defer the commit, like the internal-click blur,
until a later transition that really leaves the connection surface.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The 04507_mvt_encode_state_serialize failure in Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) is unrelated to this PR — the diff only touches programs/server/play.html. The fix for that test under parallel replicas is already in progress: #111148.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109414&sha=b5c22cccae0a6cb219ef1a52e299f342b5261e4f&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%207%2F8%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.

The failed test is test_replicated_database/test.py::test_replicated_table_structure_alter — a known flaky test tracked in #110036 (marked retry_ok in the CI report), unrelated to this PR, whose diff only touches programs/server/play.html. A previous fix attempt (#110145) was closed without merging.

@groeneai

Copy link
Copy Markdown
Collaborator

Confirmed: the only red check is Integration tests (amd_msan, 7/8) = test_replicated_database/test.py::test_replicated_table_structure_alter. At the same commit (b5c22cc) that test passed on amd_tsan, amd_llvm_coverage, arm_binary, and amd_asan_ubsan, so it is the known flaky #110036 (regression since 2026-07-10), unrelated to this PR (diff only touches programs/server/play.html).

Fix in progress: #111029. It targets the actual root cause (a comment/settings-only ALTER on a ReplicatedMergeTree silently dropping a column added by a concurrent ALTER ... ADD COLUMN, regression of #107491) in src/Interpreters/InterpreterAlterQuery.cpp, and supersedes the two earlier closed attempts (#110145, #110030). Its CI is currently green.

Not opening a separate PR since #111029 already covers this; tracking it to merge.

Comment thread programs/server/play.html Resolved
…on edit

`window.onpopstate` dispatches synthetic `input` events on the connection fields to
reproduce the side effects of a connection change when a Back/Forward restores a
different connection, and that replay clears the password (it is never persisted to
history). The `connection_edited` latch treated those replays as a real user edit, so a
later focus change over the connection UI - without the user touching anything - reached
the commit path and probed the restored server with the restored user and an empty
password: an unrequested authentication attempt, logged there as a failed login.

Gate the latch on `event.isTrusted`. Untrusted replays still invalidate as intended (they
bump `connection_generation`, dropping any probe armed against the connection being
navigated away from, and clear the stale credential badge); they just do not arm a commit.
The `url` listener now shares `onCredentialInput`, which already did the same work.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The Stress test (amd_debug) red on c17649532ba is unrelated to this PR (the diff is programs/server/play.html only).

Failure: Logical error: Inconsistent KeyCondition behavior (STID: 5182-2f27) in MergeTreeDataSelectExecutor::markRangesFromPKRange. CIDB history shows it since 2026-07-05, 106 occurrences in the last 21 days, 8 of them on master itself (pull_request_number = 0), and it hit ~50 unrelated pull requests on 2026-07-25 alone.

Known issue: #111421 — fix in progress in #109023 (still open, so merging master would not clear it).

A Back/Forward that lands on a different connection clears the password
and replays synthetic `input` events. The `isTrusted` gate added in the
previous commit stops those replays from arming a new edit session, but an
edit session already in progress before the navigation survived it: with
`connection_edited` (and possibly `commit_deferred`) still set, the first
later focus change leaving the connection surface committed and probed the
restored server with the cleared password, logging a spurious failed login
there. Reset both latches in the restore path before the replay.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the failures in the two amd_llvm_coverage stateless-test jobs on bd91ae60 and provide a fix in a separate PR. If a fix is already in progress, link it here.

All of them are unrelated to this pull request, whose diff only touches programs/server/play.html. CIDB history over the last 14 days confirms they are pre-existing and widespread:

  • !part.empty(): 212 occurrences, hitting ~20-34 distinct pull requests per day and master itself (pull_request_number = 0) on 5 separate days.
  • Arguments of 'A' have incorrect data types: 103 occurrences since 2026-07-21, 11-21 distinct pull requests per day, also on master (7 times).
  • 04490_any_join_constant_condition_reorder: 14 occurrences across 14 distinct pull requests since 2026-07-13.

I could not find open issues tracking any of the three, so they likely need issues filed as well.

Comment thread programs/server/play.html Resolved
@groeneai

Copy link
Copy Markdown
Collaborator

I confirm all three are unrelated to this pull request. Two of the three already have both a tracking issue and a fix; only 04490 needs new work. Details, with the concrete aborts read from this job's clickhouse-server.log rather than from the CIDB row (the reported names are normalized and, for one of them, wrong):

Failure Real abort Owner Issue
Arguments of 'A' ... (STID 2735-47bf) Arguments of 'multiply' have incorrect data types: 'n' of type 'Int256', '0.123' of type 'Float64', from 03915_exchange_tables_race.sh your own #110048, merged #110133
!part.empty() (STID 5217-5b3d) Got read request from replica 2 for unknown stream ..., from 04493_create_or_replace_materialized_view_populate_keeps_subscription_concurrent.sh #111689 (open) #110518
04490_any_join_constant_condition_reorder result differs, one extra duplicate row no fix yet; a fix task is investigating none

1. STID 2735-47bf is already fixed on master

The fatal record in this job is

2026.07.26 10:25:57 [ 37785 ] {ef4ab8d1} <Fatal> : Logical error: 'Arguments of 'multiply' have incorrect data types: 'n' of type 'Int256', '0.123' of type 'Float64''.
(comment: 03915_exchange_tables_race.sh) SELECT n * 0.123 FROM (SELECT * FROM tbl_03007_1)

which is exactly the signature your #110048 fixes, merged 2026-07-26 19:23:06Z as 2bf3033313d0a3. I partitioned every distinct commit that produced this failure in the last three days by whether it contains that merge: 0 of 37 contain it, 37 lack it. This head, bd91ae60, branches from 693a303c (2026-07-25 02:29), which is 459 commits behind master, so the job simply predates the fix. All 100 occurrences in 14 days carry the multiply message, so the whole count belongs to that one defect. Nothing new is needed here; a master merge clears it.

Worth knowing about the name: the reporter replaces every format-string parameter with a single letter, so Arguments of 'A' ... 'B' of type 'C' is parameter-blind and one STID can bucket unrelated aborts. Here it did not, but the concrete types are the only way to tell.

2. !part.empty() is a reporter misattribution, not an assertion failure

There is no !part.empty() assertion failure in this job. The only fatal record is

2026.07.26 13:07:33 [ 8294 ] {1389737d} <Fatal> : Logical error: 'Got read request from replica 2 for unknown stream test_wbyo9x7a.`.inner_id.e13a4c37-...`.'
(comment: 04493_create_or_replace_materialized_view_populate_keeps_subscription_concurrent.sh) SELECT count() FROM mv WHERE id = 999999999

raised at ParallelReplicasReadingCoordinator::handleRequest, ParallelReplicasReadingCoordinator.cpp:1295, reached through RemoteSource::onAsyncJobReady. The string !part.empty() comes from a comment in 04367_lambda_arg_backquoted_dot_no_logical_error.sql: executeQuery echoes the query text with its comments into the server log, and FuzzerLogParser names a failure by the first rg -o 'Logical error.*' match anywhere in the log, so it picked up that comment while taking the STID and stack from the real crash. This is verifiable in aggregate: of the 32 rows filed under this label in the last 14 days, 32 carry the coordinator frame and 0 carry the ASTIdentifier frame where the assertion lives.

You already removed the literal wording from that test comment in #111435 (88952b5b), merged 2026-07-27 00:07, which is also not on this head. #111708 fixes the reporter side generally, by anchoring the pattern to a real <Fatal> log record so a query echo cannot be selected.

The underlying bug is tracked as #110518 and fixed by #111689: under parallel replicas, when a projection optimization replaces the initiator's ReadFromMergeTree with a ReadFromPreparedSource, initializePipeline never runs, the empty-read-set announcement is skipped, and a follower then asks for a stream the coordinator never registered. SELECT count() answered by the exact-count projection, as here, is precisely that path.

3. 04490_any_join_constant_condition_reorder is the one genuine open item

Signature is stable: one duplicated row under the -- chained: ALL INNER then ANY INNER ON 1 section, from

SELECT * FROM t1 INNER JOIN t2 ON t1.c = t2.c ANY INNER JOIN t3 ON 1 ORDER BY ALL;

ANY INNER JOIN ... ON 1 must emit one right-side match per left row; under the ParallelReplicas plus s3 configuration it intermittently emits two. The test already has ORDER BY ALL, so this is a wrong result, not an ordering artifact.

On the count: I read the genuine class as 6 occurrences across 6 unrelated pull requests on Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) since 2026-07-21, and 0 on master. The remaining 8 of the 14 are different signatures: 5 Fast test rows on two pull requests that themselves change this join area, 2 on amd_asan_ubsan, distributed plan, parallel that are the Code: 241 host-memory collateral on that shard, and 1 QUOTA_EXCEEDED runner-quota row. It is also not a victim of the server death in this job, since it failed at 06:36:47Z and the abort was at 13:07:33Z.

There is no fixing pull request yet. A fix task is investigating it at full effort, treating it as a wrong-result bug to fix at the source rather than by pinning settings in the test, and I will post the fixing pull request link in this thread.

On filing issues

Two of the three are already tracked, at #110133 and #110518, so only 04490 would need a new issue. I do not open issues without approval; say the word and I will file one for it with the signature, the reproducing query and the cross-job history.

…t `input`

The commit that re-checks the credentials on leaving the connection surface
was licensed solely by the `connection_edited` latch, which is set from
`input`. But `#user` and `#password` are browser-autofillable, and autofilling
a saved login does not always fire `input` on them — the Documentation link
already works around the same thing a few lines above.

In that path nothing cleared the stale badge and nothing armed the commit, so
the fields could keep showing `ok`/`fail` for the credentials the page was
loaded with while already holding different ones, and finishing with the
connection UI did not re-check them.

Remember in `checked_connection` the tuple every `checkCredentials` is sent
with, and license the commit from `connectionNeedsCheck` — the latch, or a
current tuple that differs from the one the indication reflects. That catches
a value change whatever raised it. `commitConnection` now also clears the
indication, since a change with no `input` never went through
`resetCredentialsStatus`.

The history restore in `onpopstate` takes the restored tuple as the new
baseline, for the same reason it drops both latches: it is not a user edit, and
otherwise merely focusing a field and leaving again would probe the restored
server with the cleared password.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The two CI reds on a1acc5f548d are both AST-fuzzer assertions inside stress tests, unrelated to this pull request (its diff is programs/server/play.html only):

  1. Stress test (amd_tsan) — Logical error: Block structure mismatch in A stream: different columns: (STID: 0993-23fd), report. Already tracked: Logical error: Block structure mismatch in A stream: different columns: (STID: 0993-23fd) #111947 was closed as a duplicate of Logical error: Block structure mismatch in after optimization liftUpUnion stream (aggregate-state column wrapped into Tuple across UNION branches) (STID: 0993-29ef) #111185, whose fix is Fix block structure check for aggregate-state columns nested in containers #111191 (still open, so merging master would not clear it here). CIDB: 18 occurrences in 21 days over 16 distinct pull requests, 2 of them on master.

  2. Stress test (arm_debug) — Logical error: Cannot capture column A because it has incompatible type: got B, but C is expected. (STID: 3293-4e7f), report. The stack is ActionsDAG::evaluatePartialResult → executeActionForPartialResult → IExecutableFunction::execute under executeASTFuzzerQueries, which is the same family as sites 4 and 5 of AST-fuzzer-internal-path: executor/planner assertions on type-invalid inputs the analyzer normally rejects (5 sites: IColumn, KeyCondition, SingleValueData, ActionsDAG ×2) #107951 (executor asserting on type-invalid input the analyzer normally rejects), but no issue carries this STID yet. CIDB: 6 occurrences in 21 days over 6 distinct pull requests since 2026-07-14.

@groeneai, investigate the second one — Cannot capture column (STID: 3293-4e7f) — and provide a fix in a separate pull request (or fold it into #107951 if it is the same root cause). If a fix is already in progress, please link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

A fix is already in progress: #111993 (open). I confirm it covers the exact abort in this job, so no separate pull request is needed for it.

The aborting query in this job is not the one the report prints

The report's Failed query field shows

SELECT arrayMap(b -> sipHash64(b.*), [1]) FROM t1 INNER JOIN (SELECT x, y FROM t2) AS b ON t1.a = b.x ORDER BY b.x ASC, 257). Expected one of: ...

which is an earlier fuzzer mutation that failed harmlessly with SYNTAX_ERROR; the fuzzer emits many mutations under one query id and the reporter picked that one. The statement that actually aborted is in this job's fatal.log, on the Received signal Aborted (6) line:

SELECT DISTINCT arrayMap(b -> murmurHash2_64(b.*), [1])
FROM t1 GLOBAL ALL FULL OUTER JOIN (SELECT x, y FROM t2) AS b ON t1.a = b.x
ORDER BY b.x ASC

plus join_use_nulls=1, which this stress thread injects as a --client-option (9 occurrences in job.log). fatal.log has exactly one fault, so there is no second stack to consider.

Measured, on the real statement

t1(a UInt32, b Float64), t2(x UInt32, y String), both MergeTree, debug builds, clickhouse local:

statement master 1d4408f7 #111993 head d3ec18e7
the above, SETTINGS join_use_nulls = 1 134, Cannot capture column 2 because it has incompatible type: got Nullable(UInt64), but UInt64 is expected. 0
the above, without join_use_nulls 0 0
arrayMap(b -> sipHash64(b.*), [1]) ... LEFT JOIN ... ON t1.a = b.x, join_use_nulls = 1 134, same message 0
same with FULL JOIN 134, same message 0
same with INNER JOIN 0 0

The frames of the first row match this job's fatal.log exactly: ColumnFunction.cpp:383 appendArgument from FunctionsMiscellaneous.h:214 ExecutableFunctionCapture::executeImpl, ActionsDAG.cpp:1286 executeActionForPartialResult, :1568 evaluatePartialResult, :1402 updateHeader, ExpressionStep.cpp:70, Planner.cpp:593/:2434.

It is not a sixth site of #107951, so please do not fold it there

Row 3 above is hand-written SQL with no fuzzing at all, and the analyzer accepts it: a matcher (b.*) inside a lambda does not see the JOIN's nullability promotion, so the capture's declared argument type and the column it is handed disagree. #107951 consolidates sites where the analyzer would have rejected the input and only the fuzzer's internal path reaches the assertion; here the input is valid and the analyzer is what is wrong. #111993 fixes it in Analyzer/Resolve/QueryAnalyzer.cpp rather than downgrading the assertion, and the same defect also produces wrong results without aborting (a matcher in a lambda and a top-level matcher disagree on nullability).

One defect, two STIDs, and one residual

Keying on the message rather than the STID (position(test_context_raw, 'Cannot capture column') > 0, 30 days) gives 12 occurrences over 12 distinct pull requests, 0 on master, splitting perfectly by architecture: 3293-4e7f 6 hits, all arm (your figure), and 3293-46fa 6 hits, all amd. Eleven of the twelve carry the identical message got Nullable(UInt64), but UInt64 is expected and the identical three frames, so the two STIDs are one defect that rehashes because amd and arm inline differently.

The twelfth is on #111993 itself and is a different carrier path that I still have to fix: with the matcher in PREWHERE the header is computed through SourceStepWithFilter.cpp:42 applyPrewhereActions and MergeTreeSelectProcessor.cpp:497 instead of ExpressionStep, and

CREATE TABLE r1 (a LowCardinality(String), v Int16) ENGINE = MergeTree ORDER BY a;
CREATE TABLE r2 (a String, w UInt64) ENGINE = MergeTree ORDER BY a;
SELECT w, r1.a, v FROM r1 INNER JOIN r2 ON r1.a = r2.a
PREWHERE ((arrayMap(z -> tuple(* EXCEPT w), [1])[1]).1) != '';

still returns 134 on both master and #111993's head (got Tuple(LowCardinality(String), Int16, LowCardinality(String))). It needs no join_use_nulls and no fuzzer. A fix task owns that path and its Unexpected return type from tuple sibling; the fix will be a separate pull request, linked from #111993 when it opens.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 28, 2026
Merged via the queue into master with commit 8f33b87 Jul 28, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the web-ui-fix-credential-status-race branch July 28, 2026 15:11
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 28, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

Fixing PR for the third item, 04490_any_join_constant_condition_reorder: #112317.

Root cause: parallel-replicas eligibility for a join tree is decided by
allowParallelReplicasForJoinTree, which is evaluated only on the parent join of the leftmost leaf.
For (t1 ALL INNER JOIN t2) ANY INNER JOIN t3 ON 1 that is the Inner/All join, so the outer ANY
join is never examined; the initiator then ships the whole tree, ANY included, to every replica while
coordinating only the leftmost leaf's reads, so each replica applies ANY independently and the
initiator concatenates the results. That is why the extra row is a duplicate of the first rather than a
different right-side value. The fix adds the missing strictness and kind check to
should_disable_parallel_replicas, which already walks the whole join tree for the other veto rules.

The investigation also found two more shapes of the same defect that no existing rule reached, and the
PR closes both: a non-leftmost PASTE JOIN (15 of 40 runs failed outright with
Code: 62 ... You must not specify ANY or ALL for PASTE JOIN, raised by a remote replica) and an
ARRAY JOIN followed by a FULL JOIN (8 of 60 runs emitted every row twice).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants