ged/ruby-pg

[BUG] pthread_mutex_lock: Invalid argument

larskanis opened this issue · 0 comments

Ruby crashes sometimes with a pthread error when closing IO.pipe objects. This looks like a ruby bug:

/Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:470: [BUG] pthread_mutex_lock: Invalid argument (EINVAL)
ruby 3.2.0dev (2022-10-09T10:07:21Z master 546566d34b) [x86_64-darwin19]

-- Control frame information -----------------------------------------------
c:0006 p:---- s:0021 e:000020 CFUNC  :close
c:0005 p:---- s:0018 e:000017 CFUNC  :each
c:0004 p:0007 s:0014 e:000013 BLOCK  /Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:470 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC  :reverse_each
c:0002 p:0005 s:0006 e:000005 BLOCK  /Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:469 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:469:in `block (4 levels) in <top (required)>'
/Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:469:in `reverse_each'
/Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:470:in `block (5 levels) in <top (required)>'
/Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:470:in `each'
/Users/runner/work/ruby-pg/ruby-pg/spec/pg/connection_spec.rb:470:in `close'

-- C level backtrace information -------------------------------------------
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_vm_bugreport+0x7c4) [0x109cf4e64]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_bug_without_die+0x17b) [0x109b01afb]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_bug+0x6f) [0x109dfaba9]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_bug_errno+0x67) [0x109b01e77]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_notify_fd_close+0x18e) [0x109c8dbde]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(io_close_fptr+0x78) [0x109b455b8]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_io_close_m+0x2b) [0x109b5030b]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_call0_body+0x54c) [0x109cd35ec]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_call0+0x32b) [0x109cee2db]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_funcall_with_block_kw+0x49) [0x109cd5c09]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_yield+0xa7) [0x109cd5da7]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_ary_each+0x29) [0x109a53389]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_call_cfunc_with_frame+0x157) [0x109ce88c7]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_sendish+0x4c6) [0x109ceb176]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_exec_core+0x379a) [0x109cc7f2a]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_vm_exec+0xa6a) [0x109cde2aa]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(invoke_block_from_c_bh+0x754) [0x109cefa54]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_yield+0xa7) [0x109cd5da7]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_ary_reverse_each+0x9a) [0x109a5902a]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_call_cfunc_with_frame+0x157) [0x109ce88c7]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_sendish+0x4c6) [0x109ceb176]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(vm_exec_core+0x379a) [0x109cc7f2a]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_vm_exec+0xa6a) [0x109cde2aa]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(rb_vm_invoke_proc+0xc5c) [0x109cdc02c]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(thread_do_start_proc+0x2a0) [0x109c95c70]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(thread_start_func_2+0x4d0) [0x109c95300]
/Users/runner/.rubies/ruby-head/lib/libruby.3.2.dylib(thread_start_func_1+0x16c) [0x109c94bec]
/usr/lib/system/libsystem_pthread.dylib(_pthread_start+0xe0) [0x7fff203478fc]

Happened here on Macos: