@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Launch daemons with a full Phabricator environment in the overseers

Summary:
Ref T1670. Prepare for the overseers to talk directly to the database instead of using Conduit. See T1670 for discussion.

This shouldn't impact anything, except it has a very small chance of destabilizing the overseers.

Test Plan:
Ran `phd launch`, `phd debug`, `phd start`.

Ran with `--trace-memory` and verified elevated but mostly steady memory usage (8MB / overseer). This climbed by 0.05KB / sec (4MB / day) but the source of the leaks seems to be the cURL calls we're making over Conduit so this will actually fix that. Disabling `--conduit-uri` reported steady memory usage. I wasn't able to identify anything leaking within code we control. This may be something like a dynamic but capped buffer in cURL, since we haven't seen any issues in the wild.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1670

Differential Revision: https://secure.phabricator.com/D6534

+33 -17
+1 -1
bin/phd
··· 1 - ../scripts/daemon/phabricator_daemon_launcher.php 1 + ../scripts/daemon/manage_daemons.php
+27
scripts/daemon/launch_daemon.php
··· 1 + #!/usr/bin/env php 2 + <?php 3 + 4 + // NOTE: This is substantially the same as the libphutil/ "launch_daemon.php" 5 + // script, except it loads the Phabricator environment and adds some Phabricator 6 + // specific flags. 7 + 8 + $root = dirname(dirname(dirname(__FILE__))); 9 + require_once $root.'/scripts/__init_script__.php'; 10 + 11 + $flags = array(); 12 + 13 + $bootloader = PhutilBootloader::getInstance(); 14 + foreach ($bootloader->getAllLibraries() as $library) { 15 + if ($library == 'phutil') { 16 + // No need to load libphutil, it's necessarily loaded implicitly by the 17 + // daemon itself. 18 + continue; 19 + } 20 + $flags[] = '--load-phutil-library='.phutil_get_library_root($library); 21 + } 22 + 23 + // Add more flags. 24 + array_splice($argv, 2, 0, $flags); 25 + 26 + $overseer = new PhutilDaemonOverseer($argv); 27 + $overseer->run();
scripts/daemon/phabricator_daemon_launcher.php scripts/daemon/manage_daemons.php
+1
scripts/daemon/phd-daemon
··· 1 + launch_daemon.php
+4 -16
src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
··· 131 131 $flags[] = '--daemonize'; 132 132 } 133 133 134 - $bootloader = PhutilBootloader::getInstance(); 135 - foreach ($bootloader->getAllLibraries() as $library) { 136 - if ($library == 'phutil') { 137 - // No need to load libphutil, it's necessarily loaded implicitly by the 138 - // daemon itself. 139 - continue; 140 - } 141 - $flags[] = csprintf( 142 - '--load-phutil-library=%s', 143 - phutil_get_library_root($library)); 144 - } 145 - 146 134 $flags[] = csprintf('--conduit-uri=%s', PhabricatorEnv::getURI('/api/')); 147 135 148 136 if (!$debug) { ··· 160 148 $flags[] = csprintf('--phd=%s', $pid_dir); 161 149 162 150 $command = csprintf( 163 - './launch_daemon.php %s %C %C', 151 + './phd-daemon %s %C %C', 164 152 $daemon, 165 153 implode(' ', $flags), 166 154 implode(' ', $argv)); 167 155 168 - $libphutil_root = dirname(phutil_get_library_root('phutil')); 169 - $daemon_script_dir = $libphutil_root.'/scripts/daemon/'; 156 + $phabricator_root = dirname(phutil_get_library_root('phabricator')); 157 + $daemon_script_dir = $phabricator_root.'/scripts/daemon/'; 170 158 171 159 if ($debug) { 172 160 // Don't terminate when the user sends ^C; it will be sent to the ··· 175 163 SIGINT, 176 164 array(__CLASS__, 'ignoreSignal')); 177 165 178 - echo "\n libphutil/scripts/daemon/ \$ {$command}\n\n"; 166 + echo "\n phabricator/scripts/daemon/ \$ {$command}\n\n"; 179 167 180 168 phutil_passthru('(cd %s && exec %C)', $daemon_script_dir, $command); 181 169 } else {