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

Add references from Client and Statement to each other #1048

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sodabrew
Copy link
Collaborator

@sodabrew sodabrew commented May 21, 2019

This is to prevent out of order GC. Because GC of a Statement object generates server commands to release the statement, the client connection can be in the middle of some other operation like streaming a result set that doesn't allow other commands.

Add a new accessor Client#prepared_statements that returns the list of all outstanding statements. This is sort of a nice-to-have that falls out of having the Statement object references in the Client object.

This is not a complete fix yet. It crashes under large numbers of objects. Also need to document if/why the list of Statements should be/not be freed when the Client connection is closed. I think the server will automatically release the prepared statements when the connection drops, but I'm not sure.

Fixes #1043.

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.

"Commands out of sync" (or segfault) when preparing and executing statements concurrently
1 participant