-
Notifications
You must be signed in to change notification settings - Fork 549
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
Use Thread.handle_interrupt
to protect query
#592
Use Thread.handle_interrupt
to protect query
#592
Conversation
This is amazing, thank you. Does this change mean that d0a5199 can be reverted, or is that still a separate issue? |
yeah, probably. let me push a commit |
@sodabrew accidentally broke 1.8.7 with a stabby lambda -- should be green now |
client.query("SELECT sleep(2)") | ||
end | ||
rescue Timeout::Error | ||
context 'when a non-standard exception class is raised' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sodabrew i think this is the real behaviour we want to demonstrate and test for - we will protect the connection from regular Timeout.timeout
but not weird arbitrary exceptions
@sodabrew thoughts? |
@sodabrew @brianmario how can I help get this merged? |
I've been super busy at work this week and have a kid with an ear infection at home. This is a high priority item on a queue that's not getting any cycles :) |
Apologies from me as well, I need to read up on the On Fri, Mar 13, 2015 at 9:41 AM, Aaron Stone notifications@github.com
|
@sodabrew @brianmario ping, any thoughts on this? |
Sorry I've been meaning to get to this but haven't had the time to spend on On Wed, Mar 18, 2015 at 8:39 AM, Tamir Duberstein notifications@github.com
|
If I understand this correctly, the query simply won't be interrupted by a timeout? The wall-clock time for this would be 5 seconds: expect { Timeout.timeout(1) { @client.query('SELECT SLEEP(5)') } }.to raise_error(Timeout::Error) My major concern is documenting that I've read this over a few times, and I like it. I think readability is improved by handling the query_options merge in Ruby space before kicking over to C, nice work on that. |
Turns out upstream is working on this! MySQL 5.7, Percona 5.6, and MariaDB 10.1 all have I figure this means a hard timeout at the client end was never supposed to work in the first place. |
@sodabrew nice find. Is this good to land? |
This was my concern as well. If a run-away query is holding up a ruby process in a pre-fork environment, a user could continue making requests until all of the processes were starved and take the site down. Where otherwise, if we let the caller timeout a query with a What do you guys think? @charliesome @dbussink @samlambert @tmm1 do you guys have any thoughts on this? That new |
The big issue I see with using |
Doesn't |
|
@JoshMcKin agreed, but |
Hi @tamird , sorry if I wasn't clear my intention was to agree |
ping @brianmario, @charliesome et al. any more thoughts? |
Would you do a rebase to master now that prepared statements have landed? |
Rebased. |
Locally, I am getting this unit test failure. Ruby 2.0 from OS X Yosemite, MySQL 5.5.
This is the test where |
Any luck, @sodabrew? |
I found that my local MySQL always fails to reconnect – will have to track down whatever else I was hacking on. Not a blocker to merge. Merging now! |
Use `Thread.handle_interrupt` to protect `query`
\o/ this is huge |
When available, we prevent
Timeout.timeout
from corruptingconnections using
Thread.handle_interrupt
. Fixes #542./cc @sodabrew @eam @rudle @ggilder @zanker