itwillsync icon indicating copy to clipboard operation
itwillsync copied to clipboard

[Bug] Missing SIGHUP handler leaves daemon uncleanly terminated

Open Jensenwgd opened this issue 6 months ago • 1 comments

Bug: Missing SIGHUP handler leaves daemon uncleanly terminated

Location: packages/hub/src/daemon.ts lines 203-211

Problem: The daemon registers handlers for SIGTERM and SIGINT but not SIGHUP. When a user closes the terminal window on Windows, SIGHUP is sent but cleanup() is never called, leaving:

  • Orphaned Windows Firewall rules
  • Leftover hub.pid and hub.json files
  • Stuck sleep prevention flag
  • Orphaned node processes

Suggested fix: Add SIGHUP handler alongside existing SIGTERM/SIGINT:

process.on("SIGHUP", () => {
  cleanup();
  process.exit(0);
});

Environment: Windows 11 + WSL2 (Hyper-V), Node.js 20.x

Jensenwgd avatar May 11 '26 13:05 Jensenwgd

Completely missed this BUG, will look into this EOD.

shrijayan avatar May 19 '26 06:05 shrijayan