Skip to content

runtime: the coarse clock test fails under QEMU when the thread stops between its two clock reads #4500

Done

Description

@hiraditya

ffi::wait::tests::the_coarse_clock_is_never_ahead_and_never_behind_by_more_than_its_lag (from #4463) fails on the aarch64 CI job, which runs under QEMU. It failed on two pull requests on 2026-12-03 that do not change the runtime:

The test reads the coarse clock, then the precise clock, and requires the difference to be at most clock::coarse_lag_ns(). Nothing bounds the time between the two reads. When the thread stops between them, the difference grows by that time. Under QEMU on a shared runner, that happens in some of the 100000 passes.

A fix: read the precise clock before and after the coarse clock. Then check that the coarse clock is at most the second precise value, and at least the first precise value minus the lag.

let before = vx_clock_ns();
let coarse = coarse_clock_ns();
let after = vx_clock_ns();
assert!(coarse <= after, "the coarse clock is ahead");
assert!(before - coarse <= clock::coarse_lag_ns(), "the coarse clock is {} ns behind", before - coarse);

Activity

  1. added a commit that references this issue on Dec 3, 2026
    638014a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions