Skip to content

fix: track and clean up spawned processes, timers, and connections#9

Open
Flegma wants to merge 2 commits intomainfrom
audit/407-process-cleanup
Open

fix: track and clean up spawned processes, timers, and connections#9
Flegma wants to merge 2 commits intomainfrom
audit/407-process-cleanup

Conversation

@Flegma
Copy link
Copy Markdown
Contributor

@Flegma Flegma commented Apr 8, 2026

Summary

  • NetworkService: Track IP check interval and spawned bash monitor processes in class properties; add OnApplicationShutdown to clear interval and kill all processes; kill monitor process on error/stderr handlers before rejecting; remove process.on(SIGTERM) handler (cleanup now handled by lifecycle hook)
  • Throttle: Store the setInterval ID as a class property; add destroy() method that calls clearInterval
  • RconService: Only store RCON connection after successful authentication (return null on failure instead of storing a broken connection); add 5s timeout to rcon.send() calls; clear the connection timeout timer after successful connect
  • RedisManagerService: Track health check setInterval IDs in an array; add OnApplicationShutdown to clear all intervals and disconnect all Redis connections

Closes 5stackgg/5stack-panel#407
Closes 5stackgg/5stack-panel#408

Test plan

  • Verify npm run build passes with no errors
  • Deploy to dev and confirm network stats capture still works
  • Trigger application shutdown and verify no orphaned bash processes remain
  • Verify RCON connections succeed for active matches and failed connections return null
  • Verify Redis health checks continue working and clean up on shutdown

- NetworkService: track IP check interval and spawned bash processes,
  add OnApplicationShutdown to clear interval and kill processes,
  kill monitor on error/stderr, remove process.on(SIGTERM) handler
- Throttle: store setInterval ID, add destroy() method to clear it
- RconService: only store connection after successful auth, add timeout
  to rcon.send() calls, clear connection timer after successful connect
- RedisManagerService: track health check intervals, add
  OnApplicationShutdown to clear intervals and disconnect
port: matchData.server_port,
password: matchData.id,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you did this in another MR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted all RCON changes from this PR -- rcon.service.ts is back to main. Those changes are handled in the error-handling PR instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants