[DAEMON-288] SIGINT triggered in core process
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2019-10-25T20:20:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Appc Daemon 3.1.0 |
Components | appcd, appcd-nodejs |
Labels | n/a |
Reporter | Chris Barber |
Assignee | Chris Barber |
Created | 2019-10-25T19:26:07.000+0000 |
Updated | 2019-10-25T20:20:24.000+0000 |
Description
When a process spawnsappcd start
, then that process is interrupted via CTRL-C (aka SIGINT), then the core daemon process receives the SIGINT also and shutsdown. The daemon should not be receiving the SIGINT.
Comments
- Chris Barber 2019-10-25
SIGINT is propagated to the spawned core process because it's not detached on macOS and Linux.
The core was set to not detach in this commit: https://github.com/appcelerator/appc-daemon/commit/00892d87a78e405c1173a6a2164ea9901b0d9b7b#diff-30dc100d38263dd48fd4dd7ae14e0f3c
This seemingly unknown behavior was actually caused by// On macOS (and probably Linux), a detached process doesn't stick around to see // if the executable exited with an error, so we must not detach the process, // but rather disconnect it once the daemon is booted. On Windows, we have to // detach it to keep the process running and for some lucky reason, Node sticks // around to see if the executable errors. detached: process.platform === 'win32' ? detached : false,
appcd-nodejs
forcing all detached processes to beunref()
'd which in turned caused the child process"close"
event to never be emitted. - Chris Barber 2019-10-25 PR: https://github.com/appcelerator/appc-daemon/pull/438