Skip to content

Aggressive Process Termination Causes Race Conditions #14

@akramcodez

Description

@akramcodez

Description

The service enforces a hard timeout when terminating processes. If a process does not exit within 200ms after receiving SIGTERM, it is forcefully killed with SIGKILL:

const SIGKILL_TIMEOUT_MS = 200;
// ...
process.kill(-child.pid, 'SIGTERM');
await new Promise((res) => setTimeout(res, SIGKILL_TIMEOUT_MS));
if (!exited) {
  process.kill(-child.pid, 'SIGKILL');
}

This timeout is extremely short for many real-world applications.

Impact

  • Risk of data corruption for processes performing I/O or cleanup
  • Possible leftover lockfiles (e.g., git, npm) and inconsistent on-disk state
  • Reduced stability when terminating long-running or heavy processes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions