Skip to content

fix(sync): defer macOS Notifier notifications until registered - #577

Merged
Lencerf merged 1 commit into
google:mainfrom
Lencerf:fix/macos-notifier-pending
Dec 2, 2026
Merged

Lencerf merged 1 commit into
google:mainfrom
Lencerf:fix/macos-notifier-pending

Conversation

@Lencerf

@Lencerf Lencerf commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • On macOS, calling Notifier::notify() before registering the notifier with a mio::Poll failed with NotFound, unlike Linux where eventfd retains notifications regardless of registration state. This produced hundreds of spurious failed to wake up device: entity not found error logs on macOS CI in WorkerCtl / VirtioPci unit tests.
  • Record pending notifications on macOS while unregistered and deliver them upon registration so behavior matches Linux.
  • Add test_notifier_before_register in alioth/src/sync/notifier/notifier_test.rs.

Verification

  • cargo +nightly fmt --check
  • cargo test -p alioth sync::notifier
  • cargo test -p alioth virtio::dev::tests
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --target x86_64-unknown-linux-gnu -- -D warnings

On macOS, calling `Notifier::notify()` before registering the notifier
with a poll instance failed with `NotFound`, unlike Linux where the
underlying `eventfd` records notifications regardless of registration
state. This caused spurious wake-up error logs when tests or callers
notified an unregistered notifier.

Record notifications issued while unregistered and deliver them once the
notifier is registered so macOS matches Linux behavior.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 46907908027

Coverage increased (+0.01%) to 47.534%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 7 of 7 lines across 1 file are fully covered (100%).
  • 1 coverage regression across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
alioth/src/virtio/dev/dev.rs 1 74.42%

Coverage Stats

Coverage Status
Relevant Lines: 17089
Covered Lines: 7905
Line Coverage: 46.26%
Relevant Branches: 1990
Covered Branches: 1164
Branch Coverage: 58.49%
Branches in Coverage %: Yes
Coverage Strength: 964.27 hits per line

💛 - Coveralls

@Lencerf
Lencerf added this pull request to the merge queue Dec 2, 2026
Merged via the queue into google:main with commit 2d73822 Dec 2, 2026
20 checks passed
@Lencerf
Lencerf deleted the fix/macos-notifier-pending branch December 2, 2026 15:07
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.

2 participants