Skip to content

[TST] Replace timing-based concurrency assertions with deterministic synchronization #43

@tazarov

Description

@tazarov

Summary

Some concurrency tests in /Users/tazarov/GolandProjects/onnx-purego/ort/session_test.go still rely on fixed timeout windows (currently 500ms) to assert blocking behavior.

These assertions can become flaky under scheduler/CI load even when behavior is correct.

Context

Relevant tests include:

  • TestAdvancedSessionRunAndDestroyConcurrent
  • TestAdvancedSessionDestroyDoesNotBlockUnrelatedRun
  • TestTensorDestroyWaitsForInFlightRun

Goal

Use deterministic channel/handshake synchronization (or explicit state signaling) instead of timeout-based inference whenever possible.

Proposed changes

  1. Introduce explicit rendezvous points to prove when goroutines are blocked/unblocked.
  2. Keep short watchdog timeouts only as deadlock safety nets, not as primary assertions.
  3. Document the concurrency invariants each test validates.

Acceptance criteria

  • Primary pass/fail logic does not depend on elapsed wall-clock thresholds.
  • Tests remain stable across loaded CI runners.
  • Existing behavioral guarantees are preserved.

Notes

This is test reliability hardening and complements issue #24 (stress coverage).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions