Skip to content

Fix both-mode poll scheduler starvation after delayed reads #38

Description

@FtlC-ian

Justin's Expert 2K-FA packet captures exposed a deterministic bug in the both polling scheduler. When the serial read loop wakes after an even multiple of halfInterval, the catch-up loop advances through an even number of missed slots and returns to the same phase. Repeated timing at that cadence can starve one poll type indefinitely.

Observed on hardware:

  • 143 display polls and 0 status polls in one session
  • 3 display polls and 84 status polls in another
  • the status-starved and display-starved directions both occurred

Scope:

  • Make both mode fair under delayed read-loop wakeups and missed deadlines.
  • Emit at most one due poll per scheduler call; do not create an unbounded catch-up burst.
  • Preserve the configured aggregate cadence and deterministic status/display alternation.
  • Preserve off, status, and display behavior and dynamic mode changes.
  • Add regression tests for repeated delayed wakeups at even and odd multiples of halfInterval.
  • Document the corrected bounded/fair behavior if current docs describe scheduler semantics.

This issue is independent of the separate SPE-LAN-UNIT finding that 0x90 receives no reply. Do not weaken fan-policy protocol-native safety gates here. PR #34 remains blocked pending direct-USB versus LAN-unit evidence and a fresh hardware validation.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions