Skip to content

Scheduler can stop polling behind a stuck fire despite its deadline and healthy leadership #2273

Closed

Description

@JAORMX

Problem

A scheduled fire that does not terminate appears able to prevent the scheduler from discovering and claiming unrelated due schedules. Fire deadlines request cancellation but do not reliably bound how long the scheduler waits. This makes unattended monitoring brittle: schedule creation succeeds, leadership remains healthy, yet nothing executes and no failure notification arrives.

Observed incident

On October 12, 2026, a five-minute monitor was created for native execution qualification run https://github.com/stacklok/mecatl/actions/runs/38227550692 (PR #2219).

  • New schedule: pr-2219-native-ci-38227550692.
  • Created at 09:32:17 UTC, with its first due slot at 09:37:17 UTC.
  • The workflow finished at 10:32:08 UTC, but no scheduled notification arrived.
  • Inspection after completion still showed the original next-fire time, fire count 0, and no fire records. The schedule was subsequently paused manually.

Read-only investigation of the embedded mecatui runtime found:

  • Scheduling was enabled with local flock leadership; the process still held the leadership lock and renewed its lease.
  • An older pr-2219-ci-monitor fire had started on October 11 at 11:20:01 UTC, last progressed at 11:20:19 UTC, and had a deadline of 11:50:01 UTC.
  • That older fire still had no terminal stop recorded almost a day later. The same process still held and renewed its session lease.
  • No scheduler standby, lease-loss, Due-error, or Claim-error diagnostics were found in the inspected runtime log after startup.

This was not merely a notification-delivery failure: the new schedule was never claimed.

Suspected mechanism and confidence

Source inspection shows a concrete liveness weakness consistent with the runtime evidence:

  1. The scheduler waits for the current batch's fire workers in g.Wait() before returning to polling. One fire that never returns can therefore block later Due() queries and unrelated claims.
  2. Leadership renewal runs separately, so a healthy leadership lease does not prove scheduler progress.
  3. The fire watchdog requests cancellation through Service.Cancel, discarding its error. The fire path then drains run.Events() until closure, without an independent deadline escape.

Relevant code at ccfd074a81f4814b45a02275a0d283d1397ca300:

Strongly supported, not conclusively proven: no goroutine snapshot was captured, so the exact blocking location and original cause of the old fire's nontermination remain unknown. The running binary reported revision c6d7338888 with vcs.modified=true; the inspected scheduler/startup/fire files have no committed differences from that revision to ccfd074a81, but runtime uncommitted changes cannot be excluded.

Expected behavior

A stuck or uncooperative fire must not silently freeze unrelated scheduling. Deadline handling must produce a durable, inspectable outcome or an explicit degraded state, rather than leave an apparently healthy scheduler renewing leases indefinitely without making progress.

Acceptance criteria

  • Reproduce with deterministic offline fixtures: keep one fire blocked past its deadline and make another schedule due. Verify unrelated work can be discovered and started within configured capacity.
  • Decouple polling/admission progress from waiting indefinitely for an entire batch, while preserving bounded concurrency, atomic claims, and cross-replica exclusivity.
  • Cover cancellation failure, blocked cancellation, and an event channel that does not close. Ensure deadlines do not depend solely on cooperative event-channel closure.
  • Persist a truthful timeout/error or degraded state and report it through usable diagnostics; distinguish scheduler leadership health from polling/fire progress.
  • Preserve same-schedule overlap exclusion and execution ownership: do not release an execution fence and permit duplicate mutating work while the old execution may still be active. If work cannot safely be terminated, quarantine/account for it explicitly and expose exhausted capacity rather than spawning unbounded replacements.
  • Test terminal fire reporting and origin-conversation notification where supported, including a busy/idle origin and eventual recovery. A delivery failure must not erase the durable fire result.
  • Test restart/reconciliation behavior and lease/resource cleanup without leaking workers or silently losing due work.

Investigation next step

Capture a safe stacks-only goroutine snapshot from an affected process to confirm whether Scheduler.tickOnce is blocked in errgroup.Wait and locate the stuck fire/cancellation worker. Do not include session payloads, credentials, raw configuration, or private connection details in diagnostics.

Activity

  1. self-assigned this
    on Oct 12, 2026
  2. added a commit that references this issue on Oct 13, 2026
    87d79ee
  3. added a commit that references this issue on Oct 13, 2026
    8e3bea4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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