Skip to content

Fix waitGroup.Wait() blocking forever when Add is never called - #474

Merged
cschleiden merged 1 commit into
mainfrom
claude/competent-diffie
Mar 23, 2026
Merged

Fix waitGroup.Wait() blocking forever when Add is never called#474
cschleiden merged 1 commit into
mainfrom
claude/competent-diffie

Conversation

@cschleiden

Copy link
Copy Markdown
Owner

Summary

  • waitGroup.Wait() blocks indefinitely if Add() was never called, because the internal future is never resolved
  • Added an early return in Wait() when the counter is already 0
  • Added test covering the Wait() without Add() case

Fixes #472

Test plan

  • New unit test Test_WaitGroup_WaitWithoutAdd passes
  • All existing WaitGroup tests continue to pass

🤖 Generated with Claude Code

When Wait() is called without any prior Add(), the counter is already 0
but the internal future was never resolved, causing Wait() to block
indefinitely. Return early from Wait() when the counter is 0.

Fixes #472

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cschleiden
cschleiden force-pushed the claude/competent-diffie branch from 793e098 to ed92f86 Compare March 23, 2026 05:11
@cschleiden
cschleiden enabled auto-merge (rebase) March 23, 2026 05:11
@cschleiden
cschleiden disabled auto-merge March 23, 2026 05:21
@cschleiden
cschleiden merged commit dbca48e into main Mar 23, 2026
5 checks passed
@cschleiden
cschleiden deleted the claude/competent-diffie branch March 23, 2026 05:21
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.

waitGroup.Wait() will stuck if waitGroup.Add is never called.

1 participant