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

"Commands out of sync" (or segfault) when preparing and executing statements concurrently #1043

Open
fw42 opened this issue May 15, 2019 · 2 comments · May be fixed by #1048
Open

"Commands out of sync" (or segfault) when preparing and executing statements concurrently #1043

fw42 opened this issue May 15, 2019 · 2 comments · May be fixed by #1048
Milestone

Comments

@fw42
Copy link

fw42 commented May 15, 2019

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):

require "mysql2"

config = {
  :adapter=>"mysql2",
  :database=>"dunnolol",
  :username=>"root",
  :password=>"",
  :host=>"localhost",
}

# This appears to "fix" it
#GC.disable

threads = []

10.times do |i|
  threads << Thread.new do
    mysql = Mysql2::Client.new(config)
    query = "SELECT id FROM shops WHERE id = ?"

    1000.times do
      statement = mysql.prepare(query)
      statement.execute(1)

      # This also appears to "fix" it
      #statement.close
    end
  end
end

threads.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:

Segfault details
/Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:7: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.
Don't forget to include the above Crash Report log file in bug reports.

-- Control frame information -----------------------------------------------
c:0008 p:---- s:0036 e:000035 CFUNC  :_execute
c:0007 p:0021 s:0030 e:000029 BLOCK  /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:7 [FINISH]
c:0006 p:---- s:0027 e:000026 CFUNC  :handle_interrupt
c:0005 p:0029 s:0022 e:000021 METHOD /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:6
c:0004 p:0020 s:0016 e:000015 BLOCK  test/unit/shit_test.rb:20 [FINISH]
c:0003 p:---- s:0011 e:000010 CFUNC  :times
c:0002 p:0024 s:0007 e:000006 BLOCK  test/unit/shit_test.rb:17 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:6:in `execute'
/Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb:6:in `handle_interrupt'
/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'

-- Machine register context ------------------------------------------------
 rax: 0x0000000000000000 rbx: 0x00007fc65b46b6e0 rcx: 0x0000000000001601
 rdx: 0x0000000104f452ce rdi: 0x1000000000000000 rsi: 0x0000000104d6c037
 rbp: 0x0000700008385a10 rsp: 0x00007000083859f0  r8: 0x00007fc65912e520
  r9: 0x0000000000001600 r10: 0x0000000104c3e5c0 r11: 0x0000000104d6bd07
 r12: 0x0000000000000000 r13: 0x0000000000000004 r14: 0x0000000104d6c037
 r15: 0x1000000000000000 rip: 0x0000000104d2f75d rfl: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/opt/rubies/2.6.2/bin/ruby(rb_vm_bugreport+0x82) [0x1027c3722]
/opt/rubies/2.6.2/bin/ruby(rb_bug_context+0x1d3) [0x102610653]
/opt/rubies/2.6.2/bin/ruby(sigsegv+0x51) [0x1027278d1]
/usr/lib/system/libsystem_platform.dylib(_sigtramp+0x1d) [0x7fff580a1b5d]
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib(sk_pop_free+0x15) [0x104d2f75d]
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib(0x104d6bcb4) [0x104d6bcb4]
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib(0x104d6bd1d) [0x104d6bd1d]
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib(SSL_free+0x4d) [0x104c62700]
/usr/local/opt/mysql-client/lib/libmysqlclient.20.dylib(vio_ssl_delete+0x30) [0x104f2b3fa]
/usr/local/opt/mysql-client/lib/libmysqlclient.20.dylib(0x104f05569) [0x104f05569]
/usr/local/opt/mysql-client/lib/libmysqlclient.20.dylib(0x104f05956) [0x104f05956]
/usr/local/opt/mysql-client/lib/libmysqlclient.20.dylib(0x104f02ea1) [0x104f02ea1]
/Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/mysql2.bundle(rb_mysql_stmt_free+0x1d) [0x104eedc8d]
/opt/rubies/2.6.2/bin/ruby(finalize_list+0x50) [0x10263b300]
/opt/rubies/2.6.2/bin/ruby(gc_finalize_deferred+0x38) [0x10262bc48]
/opt/rubies/2.6.2/bin/ruby(rb_postponed_job_flush+0x156) [0x1027c8606]
/opt/rubies/2.6.2/bin/ruby(rb_threadptr_execute_interrupts+0x7c) [0x102765e6c]
/opt/rubies/2.6.2/bin/ruby(vm_call0_body+0x33e) [0x1027a71ae]
/opt/rubies/2.6.2/bin/ruby(rb_funcallv+0x270) [0x1027a5540]
/Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/mysql2.bundle(rb_mysql_stmt_execute+0xcc0) [0x104eeef90]
/opt/rubies/2.6.2/bin/ruby(vm_call_cfunc+0x161) [0x1027b6111]
/opt/rubies/2.6.2/bin/ruby(vm_exec_core+0x34bf) [0x10279c97f]
/opt/rubies/2.6.2/bin/ruby(rb_vm_exec+0xa6e) [0x1027b0b8e]
/opt/rubies/2.6.2/bin/ruby(rb_yield+0x9e) [0x1027a9dce]
/opt/rubies/2.6.2/bin/ruby(rb_thread_s_handle_interrupt+0x193) [0x10276af03]
/opt/rubies/2.6.2/bin/ruby(vm_call_cfunc+0x161) [0x1027b6111]
/opt/rubies/2.6.2/bin/ruby(vm_exec_core+0x320f) [0x10279c6cf]
/opt/rubies/2.6.2/bin/ruby(rb_vm_exec+0xa6e) [0x1027b0b8e]
/opt/rubies/2.6.2/bin/ruby(rb_yield_1+0x5e) [0x1027a9cfe]
/opt/rubies/2.6.2/bin/ruby(int_dotimes+0x118) [0x102698878]
/opt/rubies/2.6.2/bin/ruby(vm_call_cfunc+0x161) [0x1027b6111]
/opt/rubies/2.6.2/bin/ruby(vm_exec_core+0x320f) [0x10279c6cf]
/opt/rubies/2.6.2/bin/ruby(rb_vm_exec+0xa6e) [0x1027b0b8e]
/opt/rubies/2.6.2/bin/ruby(thread_do_start+0x31c) [0x10276dd1c]
/opt/rubies/2.6.2/bin/ruby(thread_start_func_2+0x1f6) [0x10276d6c6]
/opt/rubies/2.6.2/bin/ruby(thread_start_func_1+0x117) [0x10276d307]
/usr/lib/system/libsystem_pthread.dylib(_pthread_body+0x7e) [0x7fff580aa2eb]
/usr/lib/system/libsystem_pthread.dylib(0x7fff580ad249) [0x7fff580ad249]

-- Other runtime information -----------------------------------------------

* Loaded script: test/unit/shit_test.rb

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/enc/encdb.bundle
    5 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/enc/trans/transdb.bundle
    6 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/rbconfig.rb
    7 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/compatibility.rb
    8 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/defaults.rb
    9 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/deprecate.rb
   10 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/errors.rb
   11 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/version.rb
   12 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/requirement.rb
   13 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/platform.rb
   14 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/basic_specification.rb
   15 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/stub_specification.rb
   16 /opt/rubies/2.6.2/lib/ruby/2.6.0/delegate.rb
   17 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/rfc2396_parser.rb
   18 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/rfc3986_parser.rb
   19 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/common.rb
   20 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/generic.rb
   21 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/file.rb
   22 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/ftp.rb
   23 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/http.rb
   24 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/https.rb
   25 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/ldap.rb
   26 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/ldaps.rb
   27 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri/mailto.rb
   28 /opt/rubies/2.6.2/lib/ruby/2.6.0/uri.rb
   29 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/specification_policy.rb
   30 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/util/list.rb
   31 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/stringio.bundle
   32 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/specification.rb
   33 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/exceptions.rb
   34 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/util.rb
   35 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/bundler_version_finder.rb
   36 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/dependency.rb
   37 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb
   38 /opt/rubies/2.6.2/lib/ruby/2.6.0/monitor.rb
   39 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb
   40 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/core_ext/kernel_warn.rb
   41 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems.rb
   42 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/path_support.rb
   43 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/version.rb
   44 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/core_ext/name_error.rb
   45 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/levenshtein.rb
   46 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/jaro_winkler.rb
   47 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checker.rb
   48 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   49 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   50 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checkers/name_error_checkers.rb
   51 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checkers/method_name_checker.rb
   52 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checkers/key_error_checker.rb
   53 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/spell_checkers/null_checker.rb
   54 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean/formatters/plain_formatter.rb
   55 /opt/rubies/2.6.2/lib/ruby/gems/2.6.0/gems/did_you_mean-1.3.0/lib/did_you_mean.rb
   56 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/version.rb
   57 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/compatibility_guard.rb
   58 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/pathname.bundle
   59 /opt/rubies/2.6.2/lib/ruby/2.6.0/pathname.rb
   60 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/constants.rb
   61 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/text.rb
   62 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/user_interaction.rb
   63 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/etc.bundle
   64 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/config_file.rb
   65 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb
   66 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/current_ruby.rb
   67 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb
   68 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/fileutils/lib/fileutils.rb
   69 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendored_fileutils.rb
   70 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/errors.rb
   71 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/environment_preserver.rb
   72 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/plugin/api.rb
   73 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/plugin.rb
   74 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source/git.rb
   75 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source/installed.rb
   76 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source/specific_file.rb
   77 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source/local.rb
   78 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source/lock.rb
   79 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source/vendor.rb
   80 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/source.rb
   81 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/gem_helpers.rb
   82 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/match_platform.rb
   83 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/rubygems_ext.rb
   84 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/build_metadata.rb
   85 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler.rb
   86 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/settings.rb
   87 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/yaml_serializer.rb
   88 /opt/rubies/2.6.2/lib/ruby/2.6.0/rubygems/ext/builder.rb
   89 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/feature_flag.rb
   90 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source.rb
   91 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source/path.rb
   92 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source/git.rb
   93 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source/rubygems.rb
   94 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/lockfile_parser.rb
   95 /opt/rubies/2.6.2/lib/ruby/2.6.0/set.rb
   96 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/definition.rb
   97 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/dependency.rb
   98 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/ruby_dsl.rb
   99 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/dsl.rb
  100 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source_list.rb
  101 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source/metadata.rb
  102 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/ruby_version.rb
  103 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/uri_credentials_filter.rb
  104 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/lazy_specification.rb
  105 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/index.rb
  106 /opt/rubies/2.6.2/lib/ruby/2.6.0/tsort.rb
  107 /opt/rubies/2.6.2/lib/ruby/2.6.0/forwardable/impl.rb
  108 /opt/rubies/2.6.2/lib/ruby/2.6.0/forwardable.rb
  109 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/spec_set.rb
  110 /opt/rubies/2.6.2/lib/ruby/2.6.0/shellwords.rb
  111 /opt/rubies/2.6.2/lib/ruby/2.6.0/fileutils/version.rb
  112 /opt/rubies/2.6.2/lib/ruby/2.6.0/fileutils.rb
  113 /opt/rubies/2.6.2/lib/ruby/2.6.0/tmpdir.rb
  114 /opt/rubies/2.6.2/lib/ruby/2.6.0/tempfile.rb
  115 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source/git/git_proxy.rb
  116 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/digest.bundle
  117 /opt/rubies/2.6.2/lib/ruby/2.6.0/digest.rb
  118 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/digest/sha1.bundle
  119 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb
  120 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
  121 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb
  122 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb
  123 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb
  124 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
  125 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
  126 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb
  127 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
  128 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb
  129 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb
  130 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb
  131 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb
  132 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
  133 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
  134 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb
  135 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb
  136 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb
  137 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb
  138 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb
  139 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendor/molinillo/lib/molinillo.rb
  140 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/vendored_molinillo.rb
  141 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/resolver/spec_group.rb
  142 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/resolver.rb
  143 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/source/gemspec.rb
  144 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/runtime.rb
  145 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/dep_proxy.rb
  146 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/ui.rb
  147 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/ui/silent.rb
  148 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/ui/rg_proxy.rb
  149 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/remote_specification.rb
  150 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/stub_specification.rb
  151 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/endpoint_specification.rb
  152 /Users/flo/.gem/ruby/2.6.2/gems/bundler-1.17.3/lib/bundler/setup.rb
  153 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/date_core.bundle
  154 /opt/rubies/2.6.2/lib/ruby/2.6.0/date.rb
  155 /opt/rubies/2.6.2/lib/ruby/2.6.0/x86_64-darwin18/bigdecimal.bundle
  156 /opt/rubies/2.6.2/lib/ruby/2.6.0/bigdecimal.rb
  157 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/version.rb
  158 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/error.rb
  159 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/mysql2.bundle
  160 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/result.rb
  161 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/client.rb
  162 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/field.rb
  163 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2/statement.rb
  164 /opt/rubies/2.6.2/lib/ruby/2.6.0/timeout.rb
  165 /Users/flo/.gem/ruby/2.6.2/bundler/gems/mysql2-c8c346db72b5/lib/mysql2.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html

[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.

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.

@sodabrew
Copy link
Collaborator

Thank you for the thorough report! Yes, your hypothesis sounds right on GC objects.

@sodabrew sodabrew added this to the 0.5.3 milestone May 15, 2019
@fw42
Copy link
Author

fw42 commented May 15, 2019

Hm. This looks like a multi-threaded version of #956 (which was supposedly fixed in #958, but maybe only for the single-threaded case?).

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 a pull request may close this issue.

2 participants