Skip to content

Correctly destroy a backing off connection#620

Merged
fabianfett merged 4 commits intovapor:mainfrom
adam-fowler:destroy-backingoff-connection
Feb 20, 2026
Merged

Correctly destroy a backing off connection#620
fabianfett merged 4 commits intovapor:mainfrom
adam-fowler:destroy-backingoff-connection

Conversation

@adam-fowler
Copy link
Copy Markdown
Contributor

@adam-fowler adam-fowler commented Feb 13, 2026

If a connection pool has multiple requests backing off, when we are in the connectionCreationFailing state only one of these is allowed to continue. All others are destroyed. Previously we called destroyFailedConnection but this would precondition for multiple reasons. Instead we should have a function specific for destroying a backoff connection, which also clears the timers correctly.

Correctly destroy a backing off connection

If a connection pool has multiple requests backing off, when we are in the connectionCreationFailing state only one of these is allowed to continue. All others are destroyed. So it is valid to have a connection request in the backing off state when it is destroyed
@adam-fowler adam-fowler marked this pull request as draft February 13, 2026 10:55
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.53%. Comparing base (88e1545) to head (54f98ea).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nPoolModule/PoolStateMachine+ConnectionGroup.swift 77.77% 2 Missing ⚠️
...ources/ConnectionPoolModule/PoolStateMachine.swift 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #620      +/-   ##
==========================================
+ Coverage   76.37%   76.53%   +0.15%     
==========================================
  Files         134      134              
  Lines       10170    10179       +9     
==========================================
+ Hits         7767     7790      +23     
+ Misses       2403     2389      -14     
Files with missing lines Coverage Δ
...nPoolModule/PoolStateMachine+ConnectionGroup.swift 90.21% <77.77%> (+0.50%) ⬆️
...ources/ConnectionPoolModule/PoolStateMachine.swift 90.12% <50.00%> (+0.63%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adam-fowler adam-fowler changed the title Don't crash in destroyFailedConnection when backingOff Correctly destroy a backing off connection Feb 13, 2026
@adam-fowler adam-fowler marked this pull request as ready for review February 13, 2026 11:30
Copy link
Copy Markdown
Collaborator

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

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

Thank you!

@fabianfett fabianfett merged commit 7fa45c5 into vapor:main Feb 20, 2026
10 checks passed
@fabianfett fabianfett added the semver-patch No public API change. label Feb 20, 2026
@adam-fowler adam-fowler deleted the destroy-backingoff-connection branch February 20, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants