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

Support prepared_statement.close #673

Merged
merged 1 commit into from
Sep 13, 2015
Merged

Conversation

jeremy
Copy link
Contributor

@jeremy jeremy commented Sep 8, 2015

Useful when caching prepared statements. Evicted statements can release
server resources immediately rather than waiting for Ruby GC.

@sodabrew
Copy link
Collaborator

sodabrew commented Sep 8, 2015

Cool! Can be rebased now since that spec is fixed.

@sodabrew sodabrew added this to the 0.4.1 milestone Sep 8, 2015
@sodabrew
Copy link
Collaborator

sodabrew commented Sep 9, 2015

Ping for rebase :)

@jeremy
Copy link
Contributor Author

jeremy commented Sep 9, 2015

Done!

@sodabrew
Copy link
Collaborator

sodabrew commented Sep 9, 2015

Looks like closing the statement handle is causing some knock-on memory allocation effects, I'm digging into this.

Useful when caching prepared statements. Evicted statements can release
server resources immediately rather than waiting for Ruby GC.
@sodabrew
Copy link
Collaborator

Based on the comments on https://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-execute.html it appears that attempting to use a statement handle after you've freed it will segfault the client library instead of returning a clean error. Ideas:

  • Add checks before all other mysql_stmt_* methods that the stmt_wrapper->closed is zero.
  • Set stmt_wrapper->stmt = NULL right after calling mysql_stmt_close on it.

sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 13, 2015
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 13, 2015
@sodabrew sodabrew merged commit ef5d61d into brianmario:master Sep 13, 2015
@jeremy jeremy deleted the statement-close branch September 20, 2017 04:56
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.

None yet

2 participants