aboutsummaryrefslogtreecommitdiffstats
path: root/tool/lib
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-06-02 17:18:09 +0900
committerKoichi Sasada <ko1@atdot.net>2020-06-02 17:21:03 +0900
commit56ca006784d8737463857776a807c6f656ca8455 (patch)
tree640d2b52b49de552206e25873b0e249921103904 /tool/lib
parent40ced763b4f97dd3bc3abfd4cb16580f7cf8e898 (diff)
downloadruby-56ca006784d8737463857776a807c6f656ca8455.tar.gz
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().
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/envutil.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb
index 9d1521bf9b..fb9d1fa23a 100644
--- a/tool/lib/envutil.rb
+++ b/tool/lib/envutil.rb
@@ -72,20 +72,28 @@ module EnvUtil
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