Skip to content

runtime: allocate unique event IDs across wraparound - #134

Merged
AFOliveira merged 1 commit into
aifoundry-org:masterfrom
AFOliveira:fix/event-id-wrap
Jul 17, 2026
Merged

AFOliveira merged 1 commit into
aifoundry-org:masterfrom
AFOliveira:fix/event-id-wrap

Conversation

@AFOliveira

Copy link
Copy Markdown
Member

Problem

EventId is a 16-bit value. EventManager::getNextId() incremented through wraparound and ignored whether std::set::emplace() actually inserted the ID. If an older command with that ID was still in flight, the newer command reused it; the first completion erased the shared entry and the second produced Couldn't dispatch event: 65535. Long ET inference runs reproduced this and could leave the device unhealthy.

Fix

  • scan for a free ID at wraparound and never reuse an in-flight or still-blocked ID
  • fail before submitting a duplicate command if all 65,536 IDs are concurrently occupied
  • retain the ID until runtime observers consume the completion
  • add wraparound, collision, and exhaustion regression tests

Validation

  • git diff --check
  • focused tests are included; full container build/CI is pending on this draft

Paired host/CI containment is being prepared in aifoundry-org/hf-hackathon#117.

@AFOliveira
AFOliveira marked this pull request as ready for review July 17, 2026 14:17
@AFOliveira
AFOliveira merged commit 836a4ab into aifoundry-org:master Jul 17, 2026
2 checks passed
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