Skip to content

Retrying on SolidQueue::Processes errors doesn't work #786

Closed as not planned

Description

@chvp

From #313, I understood that it is expected behaviour that we can configure a job to be retried in this case. This doesn't seem to work however.

From #422 (comment), I understood that it is somewhat expected that you can't actually use retry_on for these errors, but this isn't clearly documented IMO.

We have a setup where we run some jobs on very cheap machines that can be shut down at any moment, so we would like to be able to use retry_on on these jobs (or at least a similar mechanism).

Activity

  1. rosa commented on Aug 29, 2026

    @rosa
    Member

    Hey @chvp, thanks for the report. retry_on can't catch these, and it's not something we can make work: ProcessPrunedError and ProcessExitError are never raised inside your job. They're recorded by another process (the one pruning the dead worker, or the supervisor reaping a crashed fork), which writes the failed execution after the fact, and Active Job's retry machinery only sees exceptions raised while perform runs.

    You're right that the docs were lacking. Since v1.7.0 there's a section on jobs interrupted by non-graceful process death with the reasoning (the job itself may be what's killing the process, so retrying blindly can take down the next worker too) and a recipe for your own recovery policy: subscribe to the fail_many_claimed.solid_queue event, which includes the error and the job IDs, and re-enqueue the jobs you know are safe to retry. For preemptible machines, that's the mechanism I'd use. #789 adds an explicit note that retry_on doesn't apply. I'll close this one; #591 has more on why this stays loud by default.

  2. chvp commented on Aug 29, 2026

    @chvp
    Author

    Hi @rosa, thanks for the response.

    While I don't mind if that is the conclusion, I do wonder if it wouldn't be possible to actually handle this. It seems to me that at the time the job is marked as failed, Solid Queue has both a job instance and an exception instance. The exception handling code is also just a method in ActiveJob (well, ActiveSupport to be precise, but it's included in the Base job class). So I would think it would be possible to call that method at that time?

    As for the reasoning that this could be killing workers, I definitely do get that, but I'd argue that the ActiveJob retry_on tooling is a much more ergonomic way to prevent that than subscribing to that event and reimplementing fail counters/delays/... oneself. If the Errors used wouldn't inherit from StandardError but from Exception I would think that that'd be warning of "here be dragons" to experienced Ruby developers.

  3. added a commit that references this issue on Aug 30, 2026
    e1ed16e
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