Skip to content

bug: Tasks stuck in queue and duplicated indefinitely after nightly server restart #1566

Closed as not planned

Description

@saneruby

Provide environment information

System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (4) x64 unknown
Memory: 14.89 GB / 19.34 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 22.6.0 - ~/.nvm/versions/node/v22.6.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v22.6.0/bin/npm
bun: 1.1.22 - ~/.bun/bin/bun

Describe the bug

I'm running a self-hosted Trigger.dev, following the setup instructions [here](https://trigger.dev/docs/open-source-self-hosting) and deploying using [triggerdotdev/docker](https://github.com/triggerdotdev/docker).

The issue arises every night after server restart:

  1. Random task gets stuck in the queued state and does not execute.
  2. The same task repeatedly appears in the queue, leading to thousands of duplicates over time (see the attached screenshots).
  3. Manual cancellation of all queued tasks is the only way to allow the task to start properly again. However, canceling 3,800+ tasks manually is time-consuming and impractical.

I've already tried the following steps without success:

  • Running ./stop.sh, ./update.sh, and ./start.sh.
  • Ensuring I'm on the latest version of the self-hosted stack.

Steps to Reproduce:

  1. Run Trigger.dev self-hosted.
  2. Restart server while some task is executing.
  3. Observe tasks getting stuck in queued and duplicated indefinitely.

Expected Behavior:

  • The task should either resume or fail cleanly after restart.
  • Queued tasks should not duplicate endlessly.

Screenshots:

  • Tasks Dashboard: Showing 3800+ queued tasks.
  • Task Runs List: Evidence of duplication and stalled executions.

Environment Details:


Additional Information:
Please advise where I should look to troubleshoot this issue further:

  1. Could this be related to database locking or an issue with worker recovery after restart?
  2. Are there configurations or logs I should check to identify the root cause?
  3. Is there a way to bulk cancel thousands of queued tasks efficiently?

Any guidance on fixing this or preventing task duplication would be greatly appreciated.


Thank you!
Attachments: (Screenshots included)

  1. Tasks Dashboard view.
  2. Task Runs list view.

Let me know if you need more details!

Reproduction repo

https://github.com/triggerdotdev/docker

To reproduce

  1. Run Trigger.dev self-hosted.
  2. Restart server while some task is executing.
  3. Observe tasks getting stuck in queued and duplicated indefinitely.

Additional information

2024-12-16_11-56-04
2024-12-16_11-58-54

Activity

  1. yassineatik commented on Feb 6, 2025

    @yassineatik

    My problem is the task stays at QUEUE for a very long time (+2mins), and it's the only task that's running so it doesn't make sense to take that long

  2. saneruby commented on Feb 6, 2025

    @saneruby
    Author

    the problem remained even after updating to the latest version, you have to delete the stack and volumes every time, restart the stack and build functions. I don't understand where to ask for help, there was no feedback from the developer.

  3. unckleg commented on Feb 6, 2025

    @unckleg

    @lpkobamn does that mean you lost all user's, settings, previous jobs alert integrations? I'm not sure how to proceed I have the same issue after changing the docker registry from docker hub to GitHub's registry.

  4. yassineatik commented on Feb 6, 2025

    @yassineatik

    You can reach them via discord:
    https://trigger.dev/docs/community

  5. matt-aitken commented on Feb 6, 2025

    @matt-aitken
    Member

    My guess is you need to login the Docker registry again. There's some discussion about this in the community including some scripts you can use.

  6. saneruby commented on Mar 9, 2025

    @saneruby
    Author

    My guess is you need to login the Docker registry again. There's some discussion about this in the community including some scripts you can use.

    Your message has nothing to do with the problem. The registry has absolutely nothing to do with it, the problem is in the hanging tasks, which is solved only after manually canceling all the hung ones or completely reinstalling the stack.

  7. dlindb commented on Jun 5, 2026

    @dlindb

    lpkobamn In the restart case, what determines whether a queued/resumed task is still valid to execute, versus being a stale duplicate that should be rejected or reconciled?

  8. matt-aitken commented on Aug 29, 2026

    @matt-aitken
    Member

    This issue refers to the v3 self-hosting stack, which has been replaced by the v4 stack. Closing as outdated. Please open a new issue if you see stuck runs on the current stack.

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