JoyCodeProxy
JoyCodeProxy copied to clipboard
fix(daemon): prevent fork bomb by filtering supervisor env variable
Critical fix for infinite process spawning issue.
Root cause:
- RunSupervisor was inheriting ALL parent environment variables when spawning child processes, including _JOYCODE_DAEMON_SUPERVISOR=1
- This caused child processes to also run in supervisor mode instead of serve mode, creating an infinite recursive fork bomb
Fixes:
-
Filter out supervisor env variable when creating child environment
- Child processes now correctly run in serve mode, not supervisor mode
- Prevents infinite process spawning
-
Separate log files to prevent file conflicts
- Supervisor logs to daemon.log
- Child serve processes log to serve.log
- Avoids file lock conflicts that caused child crashes
-
Add strings package import for HasPrefix check
Testing: ✅ Only 1 supervisor + 1 child process run (no fork bomb) ✅ daemon start/stop/restart/status all work correctly ✅ Service endpoints accessible and functional ✅ Logs properly separated and viewable