tursodatabase / tursodatabase/libsql

about the bug `thread 'main' has overflowed its stack` in Windows

Open
#2,053 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

I use the libsql = "0.9.5" in Rust
the main code as follow:

use dotenv::dotenv;
use libsql::Builder;

async fn get_book() -> Result<(), Box<dyn std::error::Error>> {
    dotenv().ok();
    let url = std::env::var("TURSO_DATABASE_URL")?;
    let token = std::env::var("TURSO_AUTH_TOKEN")?;
    let local_db = std::env::var("DB_PATH")?;

    let db = Builder::new_remote_replica(local_db, url, token)
        .build()
        .await?;

    let conn = db.connect()?;
    let rows = conn.query("select 1", ()).await?;
    println!("{:#?}", rows);
    Ok(())
}

#[tokio::main] 
async fn main() {
    if let Err(e) = get_book().await {
        eprintln!("Error: {}", e);
    }
}

the bug again display

tsql on  master [?] is 📦 v0.1.0 via 🦀 v1.86.0 took 11s 
❯ cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36s
     Running `target\debug\tsql.exe`

thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\tsql.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

I have setting in .cargo\Cargo.toml

[target.x86_64-pc-windows-msvc]
rustflags = [
    "-C", "link-arg=/STACK:8000000"
]

It didn't work.

    let rows = conn.query("select 1", ()).await?;

the query method have trouble.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Rust example on Windows with libsql 0.9.5, then isolate the conn.query("select 1", ()) call that triggers the stack overflow. Compare the behavior with linked issue 1051 and verify whether the reported Cargo stack setting changes it. Done means the query no longer overflows the stack in this scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.