fix: run libvirt Connect synchronously to prevent goroutine leak (#286)#491
fix: run libvirt Connect synchronously to prevent goroutine leak (#286)#491
Conversation
The r.conn.Connect() C binding is a blocking call that cannot be interrupted by context cancellation. Running it in a goroutine added complexity without benefit - if context fires during Connect(), the goroutine continued until Connect() returned anyway. Run Connect synchronously with context check before starting. This eliminates goroutine leak while keeping the early-return behavior when context is already cancelled. Fixes #286
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ 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: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
Run
r.conn.Connect()synchronously instead of in a goroutine.Why:
r.conn.Connect()is a blocking C binding that cannot be cancelledChanges:
Connect(): removed goroutine, added ctx check, run directlyConnectToURI(): same patternsyncimport (no longer needed)Fixes #286