Uh oh!
There was an error while loading. Please reload this page.
fix(conn): plug goroutine leaks and WaitGroup race in ssh/agent packages - #126
Conversation
- helper.go: setupContextCancellation returns cleanup func to unblock goroutine via done channel instead of self-referencing exit channel - forward.go: convert both forward() and reverseForward() first goroutine to waitGroup.Go() eliminating Add/Done race with wg.Wait() - inject.go: pipe() accepts io.WriteCloser/io.ReadCloser and closes both endpoints after first copy completes, preventing orphaned goroutine - Add comprehensive tests for pipe(), readLine(), waitForMessage(), and performMutualHandshake()
✅ Deploy Preview for devsydev canceled.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 39 minutes and 21 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Drain errChan after closing endpoints so both io.Copy goroutines have fully completed before pipe() returns, making output buffers safe to read by callers.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Re-applies the 3 bug fixes from PR #90 (reverted in PR #111):
setupContextCancellationreturnederrorbut spawned a goroutine selecting on its own exit channel, making it impossible to unblock. Changed to return(func(), error)with adonechannel; caller defers cleanup.forward()andreverseForward(), the first goroutine usedgo func()+defer wg.Done()without a precedingwg.Add(1), racing withwg.Wait(). Converted both towaitGroup.Go().pipe()spawned 2io.Copygoroutines but returned on the first error, orphaning the second forever. Changed signature to acceptio.WriteCloser/io.ReadCloserand close both endpoints after the first copy finishes.Adds comprehensive test suites for
pipe(),readLine(),waitForMessage(), andperformMutualHandshake().