From: Eric Wong Date: 2018-04-21T07:16:44+00:00 Subject: [ruby-core:86636] Re: [Ruby trunk Bug#14682] Error [BUG] unexpected THREAD_KILLED murb83@gmail.com wrote: > Bug #14682: Error [BUG] unexpected THREAD_KILLED > https://bugs.ruby-lang.org/issues/14682 > ./Users/murbano/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:200: [BUG] unexpected THREAD_KILLED I this may also be identical to https://bugs.ruby-lang.org/issues/14634 https://bugs.ruby-lang.org/issues/14659 (because you're inside a forked child) > c:0054 p:---- s:0282 e:000281 CFUNC :fork Interestingly, mon_check_owner in monitor.rb fails to detect fork: ``` def mon_check_owner if @mon_owner != Thread.current raise ThreadError, "current thread not owner" end end So, if I do: tc = Thread.current pid = fork do p [ Thread.current, tc ] exit!(Thread.current == tc) end p Process.waitpid2(pid)[1].success? # true I don't know if the above behavior with Thread.current being identical across fork is a bug or not. If it is a bug, "fixing" it may cause incompatibilities. So would adding PID check to mon_check_owner... ``` Anyways, can you try backporting at least r62934? r62934 a2d63ea2fb84c962abddae877e9493fc57cfce1a thread_sync.c: avoid reaching across stacks of dead threads Optional, but the following should be more fixes and improvements: r63124 85e9f2879373aa496c5c3c7f900ba4869a9ca3f7 offsetof(type, foo.bar) is (arguably) a GCCism r63210 b456eab2ea77eda51c8d5c06c24d195a6a2932e1 variable.c: fix thread + fork errors in autoload r63215 af72dcd91b70e94b0f8299ab0464dafe884d2695 thread_sync: redo r62934 to use fork_gen Thanks. Unsubscribe: