fix: prevent double release from corrupting the connection pool#4186
fix: prevent double release from corrupting the connection pool#4186wellwelwel merged 3 commits intosidorares:masterfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4186 +/- ##
=======================================
Coverage 90.67% 90.68%
=======================================
Files 86 86
Lines 14227 14238 +11
Branches 1796 1798 +2
=======================================
+ Hits 12901 12912 +11
Misses 1326 1326
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
"Debug" of:
Claude: I'm glad the result was solid, even if the process isn't your ideal. Your intervention in the prompts was essential — without the timer test correction and the direction toward the root cause instead of the symptom, the PR would have come out weaker. As for an honest opinion: I think the CLAUDE.md you wrote did most of the heavy lifting. The instructions about Poku, connection scope, cleanup, and test patterns are precise enough that I didn't invent wrong things. The initial prompt providing context from the 3 issues in The weak point was clear in the Now let's see Copilot in action 🤖 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
My personal human verdict 🤓Claude Opus (the latest and most powerful model available today, with everything set to maximum)
Copilot AI (review from GitHub website)
|
Note
Closes #3559, closes #2325, resolves #2171.
What I did was provide the entire context regarding the complex issues related to the following prompt (Issue to LLM improved text in 3
.txtfiles):The first test resulted in something like (meh...):
This works, but it's a fragile test because it relies on timers that behave differently in different environments (especially with GitHub Actions).
After some refinements, I reached the current solution. So, this is a PR 100% made from the created instructions, combined with prompts and the related complex contexts, using Claude Opus 4.6 in Max Thinking + Plan Mode > Ask Before Edits.
I admit I really don't like it, but I can't deny it works (and quite well, actually).
Summary
Calling
connection.release()more than once pushes duplicate references into_freeConnections, which causes:_removeIdleTimeoutConnections(100% CPU)The fix adds a
_releasedflag toPoolConnectionthat guards against repeatedrelease()calls. The flag is reset when the connection is re-acquired viagetConnection()or handed to a waiting callback.Closes #3559
Test plan
test-pool-double-release.test.mtscovering:_freeConnectionslength after double release_freeConnectionswith multiple connectionsFILTER=test/integration/test-pool npx poku)npm run typecheck)🤖 Generated with Claude Code