You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the following code (on either v0.5.2 as well as on latest master, e.g., c8c346d):
require"mysql2"config={:adapter=>"mysql2",:database=>"dunnolol",:username=>"root",:password=>"",:host=>"localhost",}# This appears to "fix" it#GC.disablethreads=[]10.timesdo |i|
threads << Thread.newdomysql=Mysql2::Client.new(config)query="SELECT id FROM shops WHERE id = ?"1000.timesdostatement=mysql.prepare(query)statement.execute(1)# This also appears to "fix" it#statement.closeendendendthreads.each(&:join)
I get the following exception:
3: from /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:6:in `execute'
2: from /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:6:in `handle_interrupt'
1: from /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:7:in `block in execute'
/Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:7:in `_execute': Commands out of sync; you can't run this command now (Mysql2::Error)
The problem does not appear (or at least not as often) when the mysql.prepare(query) is moved out of the 1000.times block.
Occasionally, this deadlocks or even segfaults my entire MRI process:
The problem does not occur if the number of threads is changed to only 1.
Adding a GC.disable at the beginning of the file "fixes" the problem. Adding a statement.close after the statement.execute also appears to fix it. So my bet is that this has something to do with garbage collection of non-closed statements.
The text was updated successfully, but these errors were encountered:
I believe I might have discovered a bug.
When running the following code (on either v0.5.2 as well as on latest master, e.g., c8c346d):
I get the following exception:
The problem does not appear (or at least not as often) when the
mysql.prepare(query)
is moved out of the1000.times
block.Occasionally, this deadlocks or even segfaults my entire MRI process:
Segfault details
The problem does not occur if the number of threads is changed to only 1.
Adding a
GC.disable
at the beginning of the file "fixes" the problem. Adding astatement.close
after thestatement.execute
also appears to fix it. So my bet is that this has something to do with garbage collection of non-closed statements.The text was updated successfully, but these errors were encountered: