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 leaking connections in fetch_optional (#2647) #3194

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

danjpgriffin
Copy link
Contributor

When using the 'Any' driver with MySQL backend, fetch_optional does not return the connection to the pool if no results are returned from the query. This is due to not all of the packets being read from the underlying stream.

This fix continues to read result packets from the stream until they have all been exhausted (just like the normal MySql drivers implementation of fetch_optional). In general, a better refactoring would be to call the MySQL fetch_optional code in the Any driver, rather than re-implementing and duplicating code.

fixes #(2647)

When using the 'Any' driver with MySQL backend, fetch_optional
does not return the connection to the pool if no results
are returned from the query. This is due to not all of the packets
being read from the underlying stream.

This fix continues to read result packets from the stream until they
have all been exhausted (just like the normal MySql drivers
implementation of fetch_optional). In general, a better refactoring would
be to call the MySQL fetch_optional code in the Any driver, rather than
re-implementing and duplicating code.
@abonander abonander merged commit c82bf43 into launchbadge:main Apr 25, 2024
62 checks passed
@danjpgriffin danjpgriffin deleted the fix-2647 branch April 27, 2024 11:06
jayy-lmao pushed a commit to jayy-lmao/sqlx that referenced this pull request Jun 6, 2024
…adge#3194)

When using the 'Any' driver with MySQL backend, fetch_optional
does not return the connection to the pool if no results
are returned from the query. This is due to not all of the packets
being read from the underlying stream.

This fix continues to read result packets from the stream until they
have all been exhausted (just like the normal MySql drivers
implementation of fetch_optional). In general, a better refactoring would
be to call the MySQL fetch_optional code in the Any driver, rather than
re-implementing and duplicating code.
jrasanen pushed a commit to jrasanen/sqlx that referenced this pull request Oct 14, 2024
…adge#3194)

When using the 'Any' driver with MySQL backend, fetch_optional
does not return the connection to the pool if no results
are returned from the query. This is due to not all of the packets
being read from the underlying stream.

This fix continues to read result packets from the stream until they
have all been exhausted (just like the normal MySql drivers
implementation of fetch_optional). In general, a better refactoring would
be to call the MySQL fetch_optional code in the Any driver, rather than
re-implementing and duplicating code.
jrasanen pushed a commit to jrasanen/sqlx that referenced this pull request Oct 14, 2024
…adge#3194)

When using the 'Any' driver with MySQL backend, fetch_optional
does not return the connection to the pool if no results
are returned from the query. This is due to not all of the packets
being read from the underlying stream.

This fix continues to read result packets from the stream until they
have all been exhausted (just like the normal MySql drivers
implementation of fetch_optional). In general, a better refactoring would
be to call the MySQL fetch_optional code in the Any driver, rather than
re-implementing and duplicating code.
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.

2 participants