From b901665ea61fc8d923ec498d708909c777967cdb Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Wed, 28 Mar 2018 15:21:39 -0500 Subject: [PATCH] Process_Unix.pm: optional stack traces and core file generation for stuck processes --- ACE/bin/PerlACE/Process_Unix.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ACE/bin/PerlACE/Process_Unix.pm b/ACE/bin/PerlACE/Process_Unix.pm index 487a2880abb..6202626cce1 100644 --- a/ACE/bin/PerlACE/Process_Unix.pm +++ b/ACE/bin/PerlACE/Process_Unix.pm @@ -586,6 +586,20 @@ sub WaitKill ($) if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; + + if ($ENV{ACE_TEST_LOG_STUCK_STACKS}) { + my $debugger = ($^O eq 'darwin') ? 'lldb' : 'gdb'; + my $commands = ($^O eq 'darwin') ? "-o 'bt all'" + : "-ex 'set pagination off' -ex 'thread apply all backtrace'"; + system "$debugger --batch -p $self->{PROCESS} $commands"; + } + + if ($ENV{ACE_TEST_GENERATE_CORE_FILE}) { + system ($^O ne 'darwin') ? "gcore $self->{PROCESS}" + : "lldb -b -p $self->{PROCESS} -o " . + "'process save-core core.$self->{PROCESS}'"; + } + $self->Kill (); } -- 2.11.4.GIT