Skip to content

bug(critical): Multiple Trail background processes causing excessive CPU usage #833

Open

Description

@kurucaner

Multiple Trail background processes causing excessive CPU usage

Priority: High
Category: Performance / Process Management
Environment: macOS, Node.js v24.21.0
Trail: 0.29.0

Description

I'm experiencing unusually high CPU usage caused by Trail's background processes.

Even after completely closing Cursor, multiple Trail processes continue running in the background.

I noticed dozens of concurrent instances of:

  • trail-code/dist/cli.js _update-check
  • trail-code/dist/cli.js _telemetry-flush
  • npm view @trailhq/trail-code version

Individual processes were consuming approximately 30–48% CPU, resulting in extremely high overall CPU usage and MacBook fans running continuously.

Steps to reproduce

  1. Install and use Trail with Cursor.
  2. Close Cursor completely.
  3. Observe running processes using Activity Monitor or top -o cpu.
  4. Look for multiple Trail CLI processes and npm version checks.

Actual behavior

  • Multiple Trail background processes remain running.
  • Update checks and telemetry flushes appear to execute concurrently.
  • CPU usage becomes unusually high.
  • Processes continue consuming resources after Cursor is closed.

Expected behavior

  • Background processes should terminate when their parent application exits, where appropriate.
  • Update checks and telemetry flushes should not spawn unlimited concurrent executions.
  • Background operations should have proper scheduling and concurrency control.

Workaround

Running the following commands immediately resolved the CPU issue:

pkill -f '/@trailhq/trail-code/dist/cli.js'
pkill -f 'npm view @trailhq/trail-code version'

After terminating these processes, CPU idle usage returned to approximately 80–90%.

This suggests a potential process lifecycle or scheduling issue in Trail's background operations.

Activity

  1. changed the title [-]Multiple Trail background processes causing excessive CPU usage[/-] [+]bug: Multiple Trail background processes causing excessive CPU usage[/+] on Nov 16, 2026
  2. changed the title [-]bug: Multiple Trail background processes causing excessive CPU usage[/-] [+]bug(critical): Multiple Trail background processes causing excessive CPU usage[/+] on Nov 16, 2026
  3. hr1juldey commented on Nov 18, 2026

    @hr1juldey

    Picked this up. On current main, the #346 guards already stop sequential recursion; what still storms is the concurrent case — N sessions starting in the same millisecond all read the stale check-window, all write, all pass the re-read, all spawn. Draft fix: an exclusive claim file (wx + a 10-minute stale takeover) taken before the spawn, in #859. Happy to adjust if you would rather see a different mechanism (OS lock, or serializing through the existing context lock).

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

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