Skip to content

matcher: fix send on closed channel#1872

Merged
github-actions[bot] merged 1 commit into
quay:mainfrom
crozzy:matcher-goroutine-bug
May 13, 2026
Merged

matcher: fix send on closed channel#1872
github-actions[bot] merged 1 commit into
quay:mainfrom
crozzy:matcher-goroutine-bug

Conversation

@crozzy
Copy link
Copy Markdown
Contributor

@crozzy crozzy commented May 12, 2026

It was possible for the matching process to panic if the TryGo loop sneaks in an extra worker as the Sender or Collector finishes and frees up a slot mid-loop. This would mean that an attempted write could happen on a closed channel.

This change adds workerWg and immediately decrements if TryGo doesn't, errrm, go, then does the usual thing of waiting for the workerWg before closing.

It was possible for the matching process to panic if the TryGo
loop sneaks in an extra worker as the Sender or Collector finishes
and frees up a slot mid-loop. This change adds workerWg.Add(1) and
immediately decrements if TryGo doesn't go, then does the usual thing of
waiting for the workerWg.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
@crozzy crozzy requested a review from a team as a code owner May 12, 2026 22:17
@crozzy crozzy requested review from hdonnay and removed request for a team May 12, 2026 22:17
@BradLugo BradLugo self-requested a review May 12, 2026 22:22
Copy link
Copy Markdown
Member

@hdonnay hdonnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, much better than atomic tricks.

@crozzy
Copy link
Copy Markdown
Contributor Author

crozzy commented May 13, 2026

/fast-forward

@github-actions github-actions Bot merged commit 284f819 into quay:main May 13, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants