Flaky SQLite test: caller_deadline_caps_open_startup_execution_and_async_execution sees Timeout instead of TimeBudgetExceeded

Offen Anfängerfreundlich
#2,743 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust, sqlite
Bereich
testing

Rechercherichtung

Beginne in crates/registry-platform-sqlite/src/statement.rs: Lies die fehlschlagende Assertion nahe Zeile 1427 und dann execute_until, insbesondere das Warten auf das Permit nahe Zeile 393 und die Zuordnung von tokio::time::timeout_at zu Timeout nahe Zeile 418. Entscheide, ob der Ablauf der asynchronen Caller-Deadline ebenfalls TimeBudgetExceeded melden sollte oder ob der Test beide Ergebnisse akzeptieren sollte, und führe dann cargo test -p registry-platform-sqlite statement::tests::caller_deadline_caps_open_startup_execution_and_async_execution wiederholt aus, idealerweise unter Last. Fertig bedeutet, dass der Test nicht mehr davon abhängt, welche Seite das Rennen gewinnt, und weiterhin beweist, dass die Deadline laufende Arbeit unterbricht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

What happened

The Rust tests (platform) job failed in the merge group for #2727 (run 44767589662, 20 Nov 2026). #2727 does not touch registry-platform-sqlite. The next merge-group run for the same PR passed, and #2727 merged.

test statement::tests::caller_deadline_caps_open_startup_execution_and_async_execution ... FAILED
panicked at crates/registry-platform-sqlite/src/statement.rs:1427:9:
assertion `left == right` failed
  left: Timeout
 right: TimeBudgetExceeded
test result: FAILED. 7 passed; 1 failed; 0 ignored

Likely cause

The failing assertion is the last one in the test. It calls execute_before with a caller deadline 1 ms away and expects TimeBudgetExceeded.

In execute_until, two observers watch the same deadline:

  • The blocking worker runs the statement, and SQLite's progress check stops it at the deadline. That returns TimeBudgetExceeded.
  • The async side waits for the worker with tokio::time::timeout_at(async_deadline, execution), and maps expiry to Timeout (line 418). The permit wait at line 393 does the same.

When the worker has not returned its result by the time the timer fires, the async side reports Timeout. With a 1 ms deadline this depends on how quickly the blocking thread starts and notices the deadline, so a loaded runner can lose the race. The synchronous startup case (line 1417) has no async timer and is not affected.

The known consumer maps both kinds to the same code: registry-adapter-engine reports Timeout and TimeBudgetExceeded as adapter.sqlite.statement-budget. So this looks like a test race rather than a defect that users would see.

Suggested fix

One of:

  • In the test, accept either Timeout or TimeBudgetExceeded for the 1 ms async case. Both show that the caller deadline stopped the work.
  • If one kind per cause is the intended contract, map expiry of the caller's deadline on the async side to TimeBudgetExceeded as well, and keep the strict assertion.

Do not lengthen the deadline to hide the race. The test is meant to prove the deadline interrupts running work.

Impact

Merge-queue entries that select the platform Rust tests can be dropped. Rerunning the entry has passed so far.

Vorherrschende Sprache
Rust
Sterne
2
Forks
0
Ø Merge
9 Std. 48 Min.
Gemergte PRs (30 T.)
151

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus registrystack/registry-stack

Alle Issues in registrystack/registry-stack

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.