Page MenuHomePhabricator

D7797.diff

diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php
--- a/scripts/__init_script__.php
+++ b/scripts/__init_script__.php
@@ -65,6 +65,22 @@
require_once $root.'/src/__phutil_library_init__.php';
PhutilErrorHandler::initialize();
+
+ // If possible, install a signal handler for SIGHUP which prints the current
+ // backtrace out to a named file. This is particularly helpful in debugging
+ // hung/spinning processes.
+ if (function_exists('pcntl_signal')) {
+ pcntl_signal(SIGHUP, '__phutil_signal_handler__');
+ }
+}
+
+function __phutil_signal_handler__($signal_number) {
+ $e = new Exception();
+ $pid = getmypid();
+ // Some phabricator daemons may not be attached to a terminal.
+ Filesystem::writeFile(
+ sys_get_temp_dir().'/phabricator_backtrace_'.$pid,
+ $e->getTraceAsString());
}
__phutil_init_script__();

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/sb/jx/ptztlywxv6agtxa4
Default Alt Text
D7797.diff (867 B)

Event Timeline