ruby-changes:61450
From: Koichi <ko1@a...>
Date: Tue, 2 Jun 2020 17:22:08 +0900 (JST)
Subject: [ruby-changes:61450] 56ca006784 (master): run lldb to investigate the stuck process.
https://git.ruby-lang.org/ruby.git/commit/?id=56ca006784 From 56ca006784d8737463857776a807c6f656ca8455 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Tue, 2 Jun 2020 17:18:09 +0900 Subject: run lldb to investigate the stuck process. Before sending signals (ABRT, KILL), use lldb to show the backtrace of a stuck process. This commit also reverts recent changes for terminate(). diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb index 9d1521b..fb9d1fa 100644 --- a/tool/lib/envutil.rb +++ b/tool/lib/envutil.rb @@ -72,20 +72,28 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/tool/lib/envutil.rb#L72 end module_function :timeout - def terminate(pid, signal = :TERM, pgroup = nil, reprieve = 3) + def terminate(pid, signal = :TERM, pgroup = nil, reprieve = 1) reprieve = apply_timeout_scale(reprieve) if reprieve signals = Array(signal).select do |sig| DEFAULT_SIGNALS[sig.to_s] or DEFAULT_SIGNALS[Signal.signame(sig)] rescue false end - signals |= [:SEGV, :ABRT, :KILL] + signals |= [:ABRT, :KILL] case pgroup when 0, true pgroup = -pid when nil, false pgroup = pid end + + if /darwin/ =~ RUBY_PLATFORM + # sudo -n: --non-interactive + # lldb -p: attach + # -o: run command + puts `sudo -n lldb -p #{pid} --batch -o "bt all" -o "call rb_vmdebug_stack_dump_all_threads()" -o quit` + end + while signal = signals.shift begin Process.kill signal, pgroup -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/