Skip to content

Rust #325: query-authority clients wait for the acknowledgement before stopping - #720

Open
rmcdaniel wants to merge 2 commits into
mainfrom
rust-325-query-ack-wait
Open

rmcdaniel wants to merge 2 commits into
mainfrom
rust-325-query-ack-wait

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

The query-authority Python and Rust clients now wait for the Worker's acknowledgement before stopping, as worker.php does (#325).

What happened. In #708 attempt 1, the MySQL 8.0 job (run 40017239524, job 120644918636) failed with target=php language=python mode=timely protocol=1.20. The run recorded one claim, one delivery, one submission and one returned result, but no acknowledgement. The query's authority was still valid and nothing was lost. worker.php already handles this race: the independent caller can see the committed result before the Worker receives the acknowledgement of its submission, so it waits for the acknowledgement inside the original budget before stopping. query-authority/python.py stopped the Worker immediately. query-authority/rust/src/main.rs did too, and passed only because its shutdown drains in-flight requests.

Change. In timely mode both clients now wait, inside the original 30 s budget, for the acknowledgement event before stopping the Worker. A Worker that exits early or a budget overrun still fails. Nothing else changes:

  • submission == acknowledgement == 1 for timely;
  • the no-history-mutation, original-authority, protocol and counter assertions;
  • every expected result.

Checked. python.py parses. The Rust client builds with its locked dependencies. The cohort runs on this PR's CI.

Security's narrowing is on private Discussion 438. The separate SQLite poll-refusal observation from the same attempt has its own issue.

…ients

worker.php already waits, inside the original 30 s budget, for the
Worker's acknowledgement of its query result before it stops: the
independent caller can see the committed result first. The Python and
Rust clients stopped immediately, so a fast caller could end the Worker
before its acknowledgement arrived (#708 attempt 1, MySQL 8.0, PHP
target, timely). Both now wait the same bounded way. The submission and
acknowledgement assertions are unchanged.
@rmcdaniel

Copy link
Copy Markdown
Member Author

Security focused source review at exact 1cbe01f: accepted in principle. The Python and Rust clients now wait for the actual acknowledgement before initiating Worker shutdown, use the unchanged process-wide 30 s deadline, retain the terminal submission/acknowledgement count, authority, protocol, counter and no-history-mutation assertions, and do not add an observer retry or widen a product budget. The Rust change makes explicit a wait that previously passed only because shutdown happened to drain in-flight work.

This correction is the right scope for the attempt-1 MySQL race. It does not erase that original and it does not resolve the independent SQLite poll refusal, now owned by #721 / Python #218. Final acceptance still needs the exact PR checks and its MySQL-family query-authority cohort to pass, followed by integration with current main and #708 before a fresh combined run. No merge or publication disposition is implied by this source acceptance.

In late-handler-sync mode the client stopped as soon as the handler
returned, but the installed SDK logs the lost authority after that, so
the expired-authority assertion could see none (#713 attempt 2, PHP
target). worker.php waits for its Worker's refusal; every non-timely
Python mode now also waits, inside the 30 s original budget, for the
expired-authority evidence before stopping. Assertions are unchanged.
@rmcdaniel

Copy link
Copy Markdown
Member Author

Security source re-review at replacement head 911b89a67da880c974da0ed20ae54396f89502f7: the added wait correctly addresses the terminal late-handler-sync failure observed on #713 and the first #720 run. The callback counter can advance before the installed SDK emits its lost-authority diagnostic; all non-timely modes now require both the mode-specific callback state and exact-claim expiry evidence before Worker shutdown.

The wait remains inside the original process-wide 30-second asyncio.timeout, adds its own explicit same-budget refusal, fails if the Worker stops first, preserves the final single-claim/delivery/result, zero-submission/acknowledgement, authority, counter, and no-history-mutation assertions, and adds no observer retry or product deadline.

No Security source blocker remains on this exact harness head. Fresh normal checks and the corrected query-authority cohort are still required. This correction classifies only the empty expiry-evidence race; it does not classify or rescue #713s MySQL 8.4 codec or two MySQL execution failures, and it does not resolve Server #721 / Python #218 poll-pressure behavior.

@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Hosted result at 911b89a67:

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant