Skip to content

registry.shutdown() queries scheduled alarms after SQLite coordinator closes #5555

Description

@mwaltzer-fx

Description

registry.shutdown() can query _rivet_schedule_events after the actor SQLite transaction coordinator closes.

A minimal actor completed one durable workflow step. The registry then remained idle without an error. An explicit await registry.shutdown() caused transaction_closed while RivetKit synchronized the scheduled actor alarm.

The actor did not define a schedule, alarm, cron task, queue, or timer.

This shutdown reproduction is separate from the transient restart case in #5554.

Environment

  • RivetKit: 2.3.11-rc.5
  • Runtime: Node.js 24.4.1
  • Platform: Linux x64
  • Engine mode: serverful remote Engine
  • Actor database: RivetKit embedded SQLite

@rivet-dev/agentos 0.2.15 was installed in the application. That package still declares an exact dependency on RivetKit 2.3.9. The application registry resolved the top-level 2.3.11-rc.5 package.

Reproduction sequence

  1. Define an actor with one durable workflow action.
  2. Start the registry with await registry.startAndWait().
  3. Create the actor and run the workflow action.
  4. Confirm that the action completed.
  5. Keep the registry idle for at least 15 seconds.
  6. Call await registry.shutdown().
  7. Observe a scheduled-alarm synchronization query after the SQLite coordinator closes.

I reproduced this result twice with 2.3.11-rc.5.

Observed result

The workflow completed before shutdown. RivetKit then logged this query during shutdown:

SELECT MIN(trigger_at) FROM _rivet_schedule_events

The native runtime returned:

error_code=transaction_closed
error_message="SQLite transaction coordinator is closed."

RivetKit then reported:

failed to sync scheduled actor alarm

Expected result

registry.shutdown() must stop scheduled-alarm synchronization before it closes the SQLite transaction coordinator.

The shutdown promise must resolve without a late database query or an error log.

Impact

The normal workflow completes. However, a pod restart or deployment cannot prove a clean Rivet shutdown. This blocks reliable graceful-termination and recovery claims.

Suspected ordering problem

The shutdown path appears to close the SQLite coordinator before all scheduled-alarm synchronization work stops.

Please confirm whether the driver alarm must stop before SQLite cleanup. A stable release with a deterministic shutdown test would resolve this production risk.

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