Skip to content

SQLite database gets locked after StatefulSet pod restart, causing "database is locked" errors until PVC is deleted #2195

Description

@loveRhythm1990

When the openshell StatefulSet is restarted (e.g., via kubectl rollout restart), the new pod sometimes starts with the SQLite database in a locked state. All subsequent ListSandboxes calls fail with:

```
database error: error returned from database: (code: 5) database is locked
```

The only recovery path we found is deleting the pod and the PVC (openshell-data-openshell-0), which forces a fresh database on next pod start.

Reproduction

  1. Run kubectl rollout restart statefulset/openshell -n openshell
  2. After the new pod is Running, call ListSandboxes — observe the database is locked 500 error

Expected behavior

The database should be accessible after pod restart without requiring PVC deletion.

Environment

  • Kubernetes StatefulSet with directpv-hdd StorageClass
  • SQLite embedded in openshell-gateway

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions