Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Connection Pool crash when requests are waiting while timer is triggered #474

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

lovetodream
Copy link
Contributor

When connections are requested from the pool in bursts, the pool might have requests in the queue while a keep alive or idle timer is triggered. This should resolve the issue, closes #472.

Currently, I've only implemented a test case to reproduce the behaviour. (The test case is a bit verbose atm, but I wanted to include the full picture for now)
One way to fix it would be to check the request queue in PoolStateMachine.connectionKeepAliveTimerTriggered(_:) and PoolStateMachine.connectionIdleTimerTriggered(_:) instead of a precondition. This can be archived by calling PoolStateMachine.handleAvailableConnection(index:availableContext:) if the queue is not empty.
Maybe this should be handled in ConnectionPool instead?

Let me know what you think @fabianfett

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.

ConnectionPool crash on keepalive with non-empty request queue
2 participants