Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rails/solid_queue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: rails/solid_queue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.3.2
Choose a head ref
  • 9 commits
  • 15 files changed
  • 4 contributors

Commits on Feb 17, 2026

  1. Fix race condition between job enqueue and concurrency unblock

    This addresses #456.
    
    There is a race condition in the concurrency control mechanism where a
    job that finishes and tries to unblock the next blocked execution can
    miss a `BlockedExecution` that is being created concurrently. This
    causes the blocked job to remain stuck until the `ConcurrencyMaintenance`
    periodic task runs (potentially minutes later).
    
    It happens as follows:
    
     1. Job A is running (semaphore value=0)
    
     2. Job B enqueue starts: reads semaphore (value=0, no row lock) →
        decides to block
    
     3. Job A finishes: `Semaphore.signal` → `UPDATE` value to 1 (succeeds
        immediately since no lock held)
    
     4. Job A: `BlockedExecution.release_one` → `SELECT` finds nothing (Job B's
        `BlockedExecution` not committed yet)
    
     5. Job B enqueue commits: `BlockedExecution` now exists but nobody will
        unblock it
    
    The root cause is that `Semaphore::Proxy#wait` doesn't lock the
    semaphore row when checking the semaphore. This allows the concurrent
    `signal` to complete before the enqueue transaction commits, creating a
    window where the `BlockedExecution` is invisible.
    
    To fix, we lock the semaphore row with `FOR UPDATE` during the wait check so that
    the enqueue transaction holds the lock from the check through
    `BlockedExecution` creation and commit. This forces a concurrent signal
    `UPDATE` to wait, guaranteeing the `BlockedExecution` is visible when
    release_one runs.
    
    This shouldn't introduce any dead locks, as there's no new circular
    dependencies introduced by these two:
    
    - Enqueue path: locks `Semaphore` row → `INSERT`s `BlockedExecution` (no lock
      on existing rows)
    - `release_one` path: locks `BlockedExecution` row (`SKIP LOCKED`) → locks
      `Semaphore` row (via wait in release)
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    rosa and claude committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    8d90eab View commit details
    Browse the repository at this point in the history
  2. Remove default value for 'mode' in CLI options

    Setting a default value will override the defaults in Configuration, which reads from the SOLID_QUEUE_SUPERVISOR_MODE environment variable, effectively making it useless
    lovro-bikic authored and rosa committed Feb 17, 2026
    Configuration menu
    Copy the full SHA
    97a3a54 View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2026

  1. Fix: Detect and warn when schedules generate multiple CRONs (#707)

    * Fix: Detect and warn when schedules generate multiple CRONs
    
    Fixes #703
    
    - Use Fugit::Nat.parse with multi: :fail to detect schedules that generate multiple CRONs
    - Raise validation error with clear message when multiple CRONs detected
    - Add tests for single CRON, multiple times (same/different minutes)
    - Prevents silent failures where only first CRON was used
    
    * Tidy up schedule parsing and error handling
    
    ---------
    
    Co-authored-by: Rosa Gutierrez <[email protected]>
    himanshukale36 and rosa authored Feb 18, 2026
    Configuration menu
    Copy the full SHA
    5518a4d View commit details
    Browse the repository at this point in the history
  2. Clean up dead thread from process_instances when replacing it

    When a thread dies, `replace_thread` deleted its entry from
    `configured_processes` but not from `process_instances`. On the next
    supervise loop, `check_and_replace_terminated_processes` would find the
    same dead thread again, call `replace_thread`, and
    `configured_processes.delete(thread_id)` would return nil — crashing
    with `undefined method 'instantiate' for nil`.
    
    Mirror the pattern already used in `ForkSupervisor#replace_fork`:
    delete from `process_instances` first and guard against the entry
    already being gone.
    
    Fixes #710
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    rosa and claude committed Feb 18, 2026
    Configuration menu
    Copy the full SHA
    b6825d0 View commit details
    Browse the repository at this point in the history
  3. Fix crash when recording a failed execution for a job that already ha…

    …s one
    
    The previous code used `create_or_find_by!` in `Job#failed_with`, passing
    an `exception` object as an attribute. When a FailedExecution already
    existed for the job (due to a unique constraint violation), the
    `find_by!` fallback tried to use the exception object as a SQL bind
    parameter, causing `TypeError: can't cast ProcessMissingError`.
    
    This state — a job having both a ClaimedExecution and a FailedExecution
    — shouldn't be possible given the transactional guarantees in
    `ClaimedExecution#failed_with`, but has been observed in practice by a
    couple of people . When it happens, `fail_orphaned_executions` crashes
    on startup, preventing Solid Queue from starting at all. I wonder if
    Mission Control is to blame here. There might be a bug or race condition
    in how it retries jobs that results in this apparently impossible
    situation.
    
    Regardless of whether the scenario is possible while using Solid Queue
    only via the public exposed API or not, the fix here is harmless and
    would allow the system to recover in any case.
    
    The fix replace `create_or_find_by!` with `create!`, rescuing
    RecordNotUnique to find and update the existing FailedExecution with the
    new error details. If the record disappears between the failed create
    and the find (race with a concurrent retry), retry the create. The
    create is wrapped in a savepoint (`requires_new: true`) so that the
    RecordNotUnique error doesn't abort the outer transaction on PostgreSQL.
    
    Also change the `expand_error_details_from_exception` callback from
    `before_create` to `before_save` (guarded by `if: :exception`) so that
    updating an existing FailedExecution with a new exception properly
    serializes the error details.
    
    Fixes #699
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    rosa and claude committed Feb 18, 2026
    Configuration menu
    Copy the full SHA
    629ae55 View commit details
    Browse the repository at this point in the history
  4. Guard against nil pid in Puma plugin stop

    When fork fails silently in restricted container environments,
    `solid_queue_pid` remains `nil`. On shutdown, Puma fires the
    stopped event and `stop_solid_queue_fork` is called, where
    `Process.waitpid(nil)` raises `TypeError`.
    
    Add an early return when `solid_queue_pid` is nil, and remove the
    now-redundant conditional on `Process.kill`.
    
    Related to #628 and #617
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    rosa and claude committed Feb 18, 2026
    Configuration menu
    Copy the full SHA
    67a91df View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2026

  1. Handle nil process in heartbeat

    When a process record is pruned from the database by another
    supervisor, the heartbeat rescues RecordNotFound and sets process to
    nil to trigger re-registration. But the heartbeat timer can fire again
    before re-registration completes, calling heartbeat on nil.
    
    Use safe navigation to make the heartbeat a no-op when process is nil.
    
    Fixes #693
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    rosa and claude committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    1017e0a View commit details
    Browse the repository at this point in the history
  2. Skip concurrency controls for jobs whose class has been removed

    When a job's class is removed from the codebase (e.g. during a deploy),
    any enqueued jobs with concurrency controls would crash the worker
    because `concurrency_limited?` returned true based solely on the
    presence of a `concurrency_key`, then delegates like `concurrency_limit`
    and `concurrency_duration` would blow up on the nil `job_class`.
    
    By also checking that `job_class` is present, we let these jobs bypass
    concurrency controls entirely. They get dispatched normally, fail at
    `ActiveJob::Base.execute` with a NameError, and become FailedExecutions
    — instead of blocking the entire queue.
    
    Fixes #522
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    rosa and claude committed Feb 19, 2026
    Configuration menu
    Copy the full SHA
    4031642 View commit details
    Browse the repository at this point in the history

Commits on Feb 20, 2026

  1. Bump solid_queue to 1.3.2

    rosa committed Feb 20, 2026
    Configuration menu
    Copy the full SHA
    0b13202 View commit details
    Browse the repository at this point in the history
Loading