Skip to content

fix(server): preserve in-memory SQLite across reconnects - #3175

Open
EmilienM wants to merge 1 commit into
NVIDIA:mainfrom
EmilienM:fix/3173-preserve-in-memory-sqlite-upstream/EmilienM
Open

fix(server): preserve in-memory SQLite across reconnects#3175
EmilienM wants to merge 1 commit into
NVIDIA:mainfrom
EmilienM:fix/3173-preserve-in-memory-sqlite-upstream/EmilienM

Conversation

@EmilienM

@EmilienM EmilienM commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🏗️ build-from-issue-agent

Summary

Preserve in-memory SQLite state when SQLx replaces the gateway's operational pooled connection. The SQLite adapter now retains a dedicated keepalive connection to the same named shared-cache database, preventing schema and object loss during sandbox cleanup.

Related Issue

Closes #3173

Changes

  • Normalize anonymous in-memory SQLite URLs to a process-unique named database and enable shared cache.
  • Retain a dedicated keepalive connection while leaving the operational pool serialized to one connection.
  • Add deterministic regression coverage proving schema, existing objects, and subsequent writes survive operational connection replacement for both accepted anonymous URL forms.
  • Document the in-memory SQLite lifetime invariant in architecture/gateway.md.

Deviations from Plan

  • Expanded the regression and normalization to cover sqlite://?mode=memory after adversarial review identified that SQLx does not name that anonymous form automatically.

Testing

  • mise run pre-commit passes — blocked by 17 pre-existing missing SPDX headers in unrelated .tekton/ and deploy/konflux/ files.
  • cargo fmt --all -- --check
  • Matched Rust 1.95 cargo clippy -p openshell-server --all-targets --features test-support -- -D warnings
  • cargo test -p openshell-server --features test-support persistence::tests -- --nocapture (63 passed, 3 pre-existing ignored)
  • Targeted explicit-delete and watcher-reconciliation compute tests
  • The unrelated OIDC test that failed during the full concurrent suite passes in isolation
  • E2E tests — not run because no e2e/ files changed and the existing Podman E2E uses file-backed SQLite, so it does not exercise this regression.

Tests added:

  • Unit: persistence::tests::sqlite_in_memory_store_survives_pool_connection_replacement
  • Integration: Existing compute deletion/reconciliation tests verified
  • E2E: N/A; deterministic persistence regression covers the failure boundary directly

Adversarial review:

  • Independent correctness/test review: clean after one confirmed alternate-URL finding was fixed and re-reviewed
  • Independent architecture/maintainability review: clean on both passes

Checklist

  • Follows Conventional Commits
  • Commit is signed off (DCO)

Documentation updated:

  • architecture/gateway.md: documented the in-memory SQLite keepalive invariant

Keep a dedicated SQLite connection alive so pool connection replacement
retains the shared in-memory schema and objects.

Closes NVIDIA#3173

Signed-off-by: Emilien Macchi <emacchi@redhat.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(server): in-memory SQLite loses objects schema during Podman sandbox cleanup

1 participant