libsql+tokio doesn't work on windows - stack overflow
I tried to use libsql (as per example) with tauri. It works flawlessly on linux and macos but it fails on windows. I think it's stuck somewhere in libsql::parser and smallvec, but I'm not certain. When I was going through the code base i went across those two references:
https://github.com/gwenn/lemon-rs/issues/8
https://github.com/gwenn/lemon-rs/pull/19
Error:
thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\rust-pg.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)
main.rs
#[tokio::main]
async fn main() {
let auth_token = String::from("token");
let url = String::from("https://<turso-db>");
let db = libsql::Builder::new_remote(url, auth_token)
.build()
.await
.unwrap();
let conn = db.connect().unwrap();
let _result = conn.query(
"SELECT name FROM users WHERE name = ?",
libsql::params!["damian"],
)
.await;
}
Cargo.toml
[package]
name = "rust-pg"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1", features = ["full"] }
libsql = { git = "https://github.com/tursodatabase/libsql" }
[patch.crates-io]
sqlite3-parser = { git = "https://github.com/LucioFranco/lemon-rs" }
Hi, we can take a look at this, but in the mean time you might be able to bump the stack size by setting this in a .cargo/config.toml
# 64 bit MSVC
[target.x86_64-pc-windows-msvc]
rustflags = [
"-C", "link-arg=/STACK:8000000"
]
# 64 bit Mingw
[target.x86_64-pc-windows-gnu]
rustflags = [
"-C", "link-arg=-Wl,--stack,8000000"
]
I've set stack size for mvsc and it did work. Thank you! Let me know if there is anything I could do to help you out. 🙂
Please consider adding this info, or a link to this issue, to your official docs and mention Windows. I had this same error and it took 30 minutes of searching to find this.