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

Possible bug: Nothing auto-releases statement #76

Closed
schveiguy opened this issue Jul 26, 2016 · 4 comments
Closed

Possible bug: Nothing auto-releases statement #76

schveiguy opened this issue Jul 26, 2016 · 4 comments
Labels

Comments

@schveiguy
Copy link
Collaborator

Command has a function releaseStatement which is supposed to clear the server resource handle for the prepared statement.

There's nothing that automatically does this. Shouldn't the command have a destructor that does this? ResultSequence purges the command, but does not release the statement (and it shouldn't, because you may go and re-execute a new result sequence!). In addition, there's no way to tell if it needs to release a statement (no way to see if it's a prepared statement or not).

I don't know what the protocol specifies. Maybe statements expire after some time and it's not required to clean it up? This is why I say "possible bug".

@Abscissa
Copy link

Abscissa commented Oct 20, 2016

The protocol docs don't say much about it, but according to the SQL docs, it does NOT get cleared until the session is terminated (I assume that means connection):

http://dev.mysql.com/doc/refman/5.7/en/deallocate-prepare.html
http://dev.mysql.com/doc/refman/5.7/en/sql-syntax-prepared-statements.html

On the bright side, prepared statements are specific to a session, and the (adjustable) prepared statement limit is per-session, not per-server. So I don't think it's a big problem since the user is still in control of it. But still, sounds like these really should get auto-released when possible.

@Abscissa Abscissa added the bug label Oct 20, 2016
@Abscissa
Copy link

This should be fixed in the new design, too. The new interface for prepared statements, Prepared, is reference-counted and releases itself in its dtor.

@Abscissa
Copy link

Abscissa commented Mar 1, 2017

Fixed in v1.0.0

@Abscissa Abscissa closed this as completed Mar 1, 2017
@schveiguy
Copy link
Collaborator Author

Awesome. Sorry haven't had a chance to look at this, I've had to stick with the old API for now. But I will invest some time soon to try and migrate all my stuff over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants