nym icon indicating copy to clipboard operation
nym copied to clipboard

WIP: Close sqlite pool before returning

Open pronebird opened this issue 7 months ago • 1 comments

Our sqlite db recovery strategies don't work on Windows because the OS prevents moving the already open file. This PR attempts to address this and in principle it attempts to close all connections to the database and ensure that sqlx relinquishes the access to db file(s).

Short summary of what this PR introduces:

  1. Close sqlx connection pools in order to close/release the db file
  2. Poll for file db file closure before renaming the corrupt db file. See: https://github.com/launchbadge/sqlx/issues/3217

What I am looking to fix in the next week:

Add a companion helper for Pool<Sqlite> that would not only close the connection pool but also poll for a bit until the file is actually closed.

JIRA-VPN-1471


This change is Reviewable

pronebird avatar May 24 '25 17:05 pronebird

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nym-explorer-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 1:45pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-nextra ⬜️ Ignored (Inspect) Visit Preview Jun 12, 2025 1:45pm
nym-next-explorer ⬜️ Ignored (Inspect) Visit Preview Jun 12, 2025 1:45pm

vercel[bot] avatar May 24 '25 17:05 vercel[bot]

looks good provided you tested this

It's tested. Also there is a test that you can run.

pronebird avatar Jun 03 '25 12:06 pronebird

seems you might have to do some additional feature-locking because mio is pulled into wasm build (from my experience, in 99.9% cases it's due to one of tokio's features)

jstuczyn avatar Jun 06 '25 11:06 jstuczyn

seems you might have to do some additional feature-locking because mio is pulled into wasm build (from my experience, in 99.9% cases it's due to one of tokio's features)

Fixed 👍

pronebird avatar Jun 06 '25 13:06 pronebird

We'll conduct a bit of testing in nym-vpn-client before merging this. Thank you for reviewing this work.

pronebird avatar Jun 06 '25 13:06 pronebird