Skip to content

fix(pipeline): fix race condition in tee that skips quads for slow consumers#336

Merged
ddeboer merged 2 commits intomainfrom
fix/tee-race-condition
Apr 9, 2026
Merged

fix(pipeline): fix race condition in tee that skips quads for slow consumers#336
ddeboer merged 2 commits intomainfrom
fix/tee-race-condition

Conversation

@ddeboer
Copy link
Copy Markdown
Member

@ddeboer ddeboer commented Apr 9, 2026

Summary

  • Fix race condition in tee() where a fast writer (e.g. FileWriter) could lap a slow writer (e.g. SparqlUpdateWriter), causing the slow writer to skip quads
  • The root cause was a shared consumed counter with no per-branch tracking – any branch could increment it, letting one branch advance the source past items another branch hadn't seen
  • Replace with per-branch consumption flags and a barrier: fast branches wait until all branches have consumed the current item before the source advances
  • Strengthen the existing fan-out test to use differently-paced writers, covering the race condition

ddeboer added 2 commits April 9, 2026 19:47
…nsumers

- The shared `consumed` counter let a fast writer (e.g. FileWriter) lap a
  slow writer (e.g. SparqlUpdateWriter), causing the slow writer to skip items
- Replace shared counter with per-branch consumption tracking and a barrier:
  fast branches wait until all branches have consumed before advancing
- Add test with differently-paced writers to cover the race condition
@ddeboer ddeboer enabled auto-merge (squash) April 9, 2026 17:52
@ddeboer ddeboer disabled auto-merge April 9, 2026 17:52
@ddeboer ddeboer enabled auto-merge (squash) April 9, 2026 17:52
@ddeboer ddeboer merged commit 33b72b3 into main Apr 9, 2026
2 checks passed
@ddeboer ddeboer deleted the fix/tee-race-condition branch April 9, 2026 17:53
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