Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15348025
D15782.id38022.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D15782.id38022.diff
View Options
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
@@ -301,7 +301,7 @@
return $pid;
}
- final public function cleanup($signo = '?') {
+ final public function cleanup($signo = null) {
global $g_future;
if ($g_future) {
$g_future->resolveKill();
@@ -310,6 +310,11 @@
Filesystem::remove($this->getPIDPath());
+ if ($signo !== null) {
+ $signame = phutil_get_signal_name($signo);
+ error_log("Caught signal {$signame}, exiting.");
+ }
+
exit(1);
}
@@ -428,6 +433,15 @@
$console = PhutilConsole::getConsole();
$this->willLaunch();
+ $log = $this->getOverseerLogPath();
+ if ($log !== null) {
+ echo tsprintf(
+ "%s\n",
+ pht(
+ 'Writing logs to: %s',
+ $log));
+ }
+
$pid = pcntl_fork();
if ($pid < 0) {
throw new Exception(
@@ -439,6 +453,12 @@
exit(0);
}
+ // Redirect process errors to the error log. If we do not do this, any
+ // error the `aphlict` process itself encounters vanishes into thin air.
+ if ($log !== null) {
+ ini_set('error_log', $log);
+ }
+
// When we fork, the child process will inherit its parent's set of open
// file descriptors. If the parent process of bin/aphlict is waiting for
// bin/aphlict's file descriptors to close, it will be stuck waiting on
@@ -529,4 +549,15 @@
$server_argv);
}
+ private function getOverseerLogPath() {
+ // For now, just return the first log. We could refine this eventually.
+ $logs = idx($this->configData, 'logs', array());
+
+ foreach ($logs as $log) {
+ return $log['path'];
+ }
+
+ return null;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 11, 2:10 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7530055
Default Alt Text
D15782.id38022.diff (1 KB)
Attached To
Mode
D15782: Send the `aphlict` process log to the `node` log
Attached
Detach File
Event Timeline
Log In to Comment