summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Mitz <mitza@ociweb.com>2018-03-28 15:21:39 -0500
committerAdam Mitz <mitza@ociweb.com>2018-04-03 09:58:17 -0500
commitb901665ea61fc8d923ec498d708909c777967cdb (patch)
treeb5778025d0941ab55eeb18b26010399fe4833efe
parentb085ae3be0e93dea15f777d50ec1e3e666eded74 (diff)
downloadATCD-b901665ea61fc8d923ec498d708909c777967cdb.tar.gz
Process_Unix.pm: optional stack traces and core file generation for stuck processes
-rw-r--r--ACE/bin/PerlACE/Process_Unix.pm14
1 files changed, 14 insertions, 0 deletions
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 ();
}