You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless instructed otherwise via the --foreground command-line flag, the nodemanager automatically daemonizes after starting up. This puts it in the background and decouples it from the controlling terminal (if any). (Otherwise, running start_seattle.sh or python nmmain.py and later closing the terminal would kill the nodemanager.)
In order to daemonize, the nodemanager fork()stwice and redirects its stdstreams from / to /dev/null effectively. Only the latter of the forked children is kept alive, the parent and first child processes both exit.
On systems with small amounts of available memory such as WiFi routers running OpenWrt, fork()ing is problematic: The parent nodemanager process consumes significant amounts of RAM already, and RAM consuption increases linearly with every fork as a copy of the parent process' memory image is created. Due to the typically low CPU speed of these devices, this transient spike in RAM consumption can lock up the system for minutes, or even cause memory exhaustion which crashes the nodemanager.
An immediate solution would be to not self-daemonize, but rather use common POSIX tools to achieve the same thing:
(nohup disables signal forwarding from the terminal to the process, the <, > redirect stdin and stdout so that the process doesn't read from or write to the terminal anymore, 2>&1 redirects stderr into the already-redirected stdout, and & puts the whole thing in the background).
This snippet would render self-daemonizing in nmmain.py unneccessary, and would replace backgrounding without detaching in the Seattle start shell script.
The text was updated successfully, but these errors were encountered:
Unless instructed otherwise via the
--foreground
command-line flag, the nodemanager automatically daemonizes after starting up. This puts it in the background and decouples it from the controlling terminal (if any). (Otherwise, runningstart_seattle.sh
orpython nmmain.py
and later closing the terminal would kill the nodemanager.)In order to daemonize, the nodemanager
fork()
s twice and redirects its stdstreams from / to/dev/null
effectively. Only the latter of the forked children is kept alive, the parent and first child processes both exit.On systems with small amounts of available memory such as WiFi routers running OpenWrt,
fork()
ing is problematic: The parent nodemanager process consumes significant amounts of RAM already, and RAM consuption increases linearly with every fork as a copy of the parent process' memory image is created. Due to the typically low CPU speed of these devices, this transient spike in RAM consumption can lock up the system for minutes, or even cause memory exhaustion which crashes the nodemanager.An immediate solution would be to not self-daemonize, but rather use common POSIX tools to achieve the same thing:
(
nohup
disables signal forwarding from the terminal to the process, the<
,>
redirectstdin
andstdout
so that the process doesn't read from or write to the terminal anymore,2>&1
redirectsstderr
into the already-redirectedstdout
, and&
puts the whole thing in the background).This snippet would render self-daemonizing in
nmmain.py
unneccessary, and would replace backgrounding without detaching in the Seattle start shell script.The text was updated successfully, but these errors were encountered: