From a7e8bdcc57aee81b0bd1a2009d95f82668c1b5f9 Mon Sep 17 00:00:00 2001 From: Junyi Ou Date: Tue, 13 Oct 2026 14:12:01 -0400 Subject: [PATCH 1/2] fix(dgw): stop libsql from closing connections twice libsql 0.9.30 closes a local connection's SQLite handle twice when it's dropped, which sometimes crashes Gateway on startup with 0xc0000005. Patch it with the tursodatabase/libsql#2261 fix from the Devolutions fork, tag 0.9.30-devo.1 (0.9.30 plus that one commit). Issue: #2070 Co-Authored-By: Claude Opus 5.5 (1M context) --- Cargo.lock | 21 +++++++-------------- Cargo.toml | 2 ++ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1fd7f9dc0..76a2ab211 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4159,8 +4159,7 @@ dependencies = [ [[package]] name = "libsql" version = "0.9.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30fe980ac5693ed1f3db490559fb578885e913a018df64af8a1a46e1959a78df" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "anyhow", "async-stream", @@ -4198,8 +4197,7 @@ dependencies = [ [[package]] name = "libsql-ffi" version = "0.9.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be1da6f123ceb2cd23f469883415cab9ee963286a85d61e22afb8b12e15e681" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "bindgen", "cc", @@ -4210,8 +4208,7 @@ dependencies = [ [[package]] name = "libsql-hrana" version = "0.9.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3358538b52cfcf9af4fe7aeb57d6843aafed2e8af80807bd636fd1448e94ea7" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "base64 0.21.7", "bytes 1.12.1", @@ -4222,8 +4219,7 @@ dependencies = [ [[package]] name = "libsql-rusqlite" version = "0.9.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b646f94fc1d266e481c38a2d44d6d9d1be3ad04b56b90457acfb310dc450030e" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "bitflags 2.13.1", "fallible-iterator 0.2.0", @@ -4236,8 +4232,7 @@ dependencies = [ [[package]] name = "libsql-sqlite3-parser" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15a90128c708356af8f7d767c9ac2946692c9112b4f74f07b99a01a60680e413" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "bitflags 2.13.1", "cc", @@ -4254,8 +4249,7 @@ dependencies = [ [[package]] name = "libsql-sys" version = "0.9.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90725458cc4461bc82f8f7983e80b002ea4f64b5184e1462f252d0dd74b122f5" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "bytes 1.12.1", "libsql-ffi", @@ -4268,8 +4262,7 @@ dependencies = [ [[package]] name = "libsql_replication" version = "0.9.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bba5c9b3a26aca06d70f6a3646ba341cf574a548355353fe135af524b1b77cc" +source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" dependencies = [ "aes 0.8.4", "async-stream", diff --git a/Cargo.toml b/Cargo.toml index f7ea0a98c..a67577659 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,8 @@ lto = true [patch.crates-io] tracing-appender = { git = "https://github.com/CBenoit/tracing.git", rev = "42097daf92e683cf18da7639ddccb056721a796c" } +# libsql 0.9.30 closes a local connection twice when it's dropped; go back to crates.io once a release has tursodatabase/libsql#2261. +libsql = { git = "https://github.com/Devolutions/libsql", tag = "0.9.30-devo.1" } [workspace.lints.rust] # Declare the custom cfgs. From a4b63c3b0938a123cb7d1d7c00ece1097c642589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Wed, 14 Oct 2026 21:53:10 +0900 Subject: [PATCH 2/2] build(deps): use libsql 0.10.0 from crates.io libsql 0.10.0 ships the tursodatabase/libsql#2261 fix, the same commit the Devolutions fork tag carried, so drop the [patch.crates-io] entry and bump the libsql requirement to 0.10 in every crate. Issue: #2070 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 61 ++++++++++++++------------ Cargo.toml | 2 - crates/agent-tunnel-libsql/Cargo.toml | 2 +- crates/devolutions-pedm/Cargo.toml | 2 +- crates/gateway-db/Cargo.toml | 2 +- crates/job-queue-libsql/Cargo.toml | 2 +- crates/traffic-audit-libsql/Cargo.toml | 2 +- testsuite/Cargo.toml | 2 +- 8 files changed, 40 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76a2ab211..37c292cb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1597,7 +1597,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccc2776f0c61eca1ca32528f85548abd1a4be8fb53d1b21c013e4f18da1e7090" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.118", ] [[package]] @@ -2384,7 +2384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3228,12 +3228,12 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite 0.2.17", - "socket2 0.5.10", + "socket2 0.6.5", "system-configuration", "tokio 1.52.3", "tower-service", "tracing", - "windows-registry 0.5.3", + "windows-registry 0.6.1", ] [[package]] @@ -3767,7 +3767,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4158,8 +4158,9 @@ dependencies = [ [[package]] name = "libsql" -version = "0.9.30" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bca1704194048f0f0bbc8a8e05ba85c0c67628b03bd59346dd2fdd946a1588" dependencies = [ "anyhow", "async-stream", @@ -4196,8 +4197,9 @@ dependencies = [ [[package]] name = "libsql-ffi" -version = "0.9.30" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f232292810b6298d17466b59bf8077d075fb016d89c281ca9dc968ea4a3b9d03" dependencies = [ "bindgen", "cc", @@ -4207,8 +4209,9 @@ dependencies = [ [[package]] name = "libsql-hrana" -version = "0.9.30" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ceb7fa4a6b75b9eeffe2a375bde04ee8f48910d135a83ffd4191ddfd346c25c" dependencies = [ "base64 0.21.7", "bytes 1.12.1", @@ -4218,8 +4221,9 @@ dependencies = [ [[package]] name = "libsql-rusqlite" -version = "0.9.30" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "699682e3695674ab37edc251b31e6fb4b5b81fb8ebabe3efc8cf2d24bb0347f5" dependencies = [ "bitflags 2.13.1", "fallible-iterator 0.2.0", @@ -4232,7 +4236,8 @@ dependencies = [ [[package]] name = "libsql-sqlite3-parser" version = "0.13.0" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a90128c708356af8f7d767c9ac2946692c9112b4f74f07b99a01a60680e413" dependencies = [ "bitflags 2.13.1", "cc", @@ -4248,8 +4253,9 @@ dependencies = [ [[package]] name = "libsql-sys" -version = "0.9.30" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4a7f2d76f49442c273a892a574a272b8b35f4bf0b1b25a475f2cc95885fe0f" dependencies = [ "bytes 1.12.1", "libsql-ffi", @@ -4261,8 +4267,9 @@ dependencies = [ [[package]] name = "libsql_replication" -version = "0.9.30" -source = "git+https://github.com/Devolutions/libsql?tag=0.9.30-devo.1#182bcfed212f4b034173669777a9bee4dbd943fb" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c8989755a2e5bec262ef4a7cfbf4765ae07b965cc39341168327d33c88f473" dependencies = [ "aes 0.8.4", "async-stream", @@ -4950,7 +4957,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6097,7 +6104,7 @@ dependencies = [ "quinn-udp", "rustc-hash 2.1.3", "rustls 0.23.43", - "socket2 0.5.10", + "socket2 0.6.5", "thiserror 2.0.20", "tokio 1.52.3", "tracing", @@ -6137,9 +6144,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.5", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6656,7 +6663,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6756,7 +6763,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -7311,7 +7318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -7615,7 +7622,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix 1.1.4", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -9085,7 +9092,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a67577659..f7ea0a98c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,8 +33,6 @@ lto = true [patch.crates-io] tracing-appender = { git = "https://github.com/CBenoit/tracing.git", rev = "42097daf92e683cf18da7639ddccb056721a796c" } -# libsql 0.9.30 closes a local connection twice when it's dropped; go back to crates.io once a release has tursodatabase/libsql#2261. -libsql = { git = "https://github.com/Devolutions/libsql", tag = "0.9.30-devo.1" } [workspace.lints.rust] # Declare the custom cfgs. diff --git a/crates/agent-tunnel-libsql/Cargo.toml b/crates/agent-tunnel-libsql/Cargo.toml index a3612b6ad..d5269e38e 100644 --- a/crates/agent-tunnel-libsql/Cargo.toml +++ b/crates/agent-tunnel-libsql/Cargo.toml @@ -14,7 +14,7 @@ anyhow = "1" async-trait = "0.1" camino = "1.1" gateway-db.path = "../gateway-db" -libsql = { version = "0.9", default-features = false, features = ["core", "serde"] } +libsql = { version = "0.10", default-features = false, features = ["core", "serde"] } tokio = { version = "1.52", features = ["sync"] } tracing = "0.1" uuid = "1.23" diff --git a/crates/devolutions-pedm/Cargo.toml b/crates/devolutions-pedm/Cargo.toml index 3cc1d2943..cf5d0cb3e 100644 --- a/crates/devolutions-pedm/Cargo.toml +++ b/crates/devolutions-pedm/Cargo.toml @@ -40,7 +40,7 @@ uuid = "1" dunce = "1.0" tower = "0.5" futures-util = "0.3" -libsql = { version = "0.9", optional = true, default-features = false, features = [ "core", "sync"] } +libsql = { version = "0.10", optional = true, default-features = false, features = [ "core", "sync"] } tokio-postgres = { version = "0.7", optional = true, features = ["with-chrono-0_4"] } bb8 = { version = "0.9", optional = true } bb8-postgres = { version = "0.9", optional = true } diff --git a/crates/gateway-db/Cargo.toml b/crates/gateway-db/Cargo.toml index 1da7eb4c6..49e12aa22 100644 --- a/crates/gateway-db/Cargo.toml +++ b/crates/gateway-db/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] anyhow = "1" camino = "1.1" -libsql = { version = "0.9", default-features = false, features = ["core"] } +libsql = { version = "0.10", default-features = false, features = ["core"] } [target.'cfg(windows)'.dependencies] windows-sys = { version = "0.61", features = ["Win32_Storage_FileSystem"] } diff --git a/crates/job-queue-libsql/Cargo.toml b/crates/job-queue-libsql/Cargo.toml index d0f681cec..efdf7da01 100644 --- a/crates/job-queue-libsql/Cargo.toml +++ b/crates/job-queue-libsql/Cargo.toml @@ -12,7 +12,7 @@ workspace = true anyhow = "1" async-trait = "0.1" job-queue = { path = "../job-queue" } -libsql = { version = "0.9", default-features = false, features = ["core", "serde", "replication"] } +libsql = { version = "0.10", default-features = false, features = ["core", "serde", "replication"] } serde = "1" time = { version = "0.3", default-features = false, features = ["std"] } tracing = "0.1" diff --git a/crates/traffic-audit-libsql/Cargo.toml b/crates/traffic-audit-libsql/Cargo.toml index 313ddc3f1..e72679d9b 100644 --- a/crates/traffic-audit-libsql/Cargo.toml +++ b/crates/traffic-audit-libsql/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] anyhow = "1" async-trait = "0.1" -libsql = { version = "0.9", default-features = false, features = ["core", "serde"] } +libsql = { version = "0.10", default-features = false, features = ["core", "serde"] } tracing = "0.1" traffic-audit.path = "../traffic-audit" ulid = "1" diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index b6c687fc1..aa8fa4fc7 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -43,7 +43,7 @@ agent-tunnel-libsql.path = "../crates/agent-tunnel-libsql" gateway-db.path = "../crates/gateway-db" ipnetwork = "0.20" jmux-proto = { path = "../crates/jmux-proto" } -libsql = { version = "0.9", default-features = false, features = ["core"] } +libsql = { version = "0.10", default-features = false, features = ["core"] } mcp-proxy.path = "../crates/mcp-proxy" network-scanner = { path = "../crates/network-scanner", features = ["test-utils"] } network-scanner-proto = { path = "../crates/network-scanner-proto" }