All problems

Shift Barrier Opens Before the Final Worker Completes

Level 2 · node · Concurrency · Synchronization barrier completion threshold error

Scenario

A fictional production line uses a barrier so its next stage begins only after three workers finish equipment checks. Each worker sends a completion signal. The current barrier opens while one worker is still unfinished, allowing the next stage to start early.

Requirements

Open the barrier only after all registered workers signal completion. Ignore duplicate completion signals from the same worker and signals from unregistered workers. Once open, the barrier stays open.

Acceptance criteria

  • The barrier stays closed after only two of three workers finish.
  • The barrier opens once all three workers finish.
  • Duplicate signals from the same worker count only once.
  • A signal from an unregistered worker does not alter barrier state.