Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyncClient hangs #48

Open
hangj opened this issue Sep 12, 2023 · 3 comments
Open

SyncClient hangs #48

hangj opened this issue Sep 12, 2023 · 3 comments

Comments

@hangj
Copy link

hangj commented Sep 12, 2023

The async Client works just fine, but the following SyncClient hangs:

#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
    let db = libsql_client::SyncClient::from_env()?;
    let response = db.execute("SELECT * FROM users")?;

    println!("{:?}", response);

    Ok(())
}
@psarna
Copy link
Contributor

psarna commented Sep 12, 2023

Thanks for reporting @hangj! I see that SyncClient gets stuck with your example, and gets unblocked once I change it from #[tokio::main(flavor = "current_thread")] to just #[tokio::main], so we probably block the current thread for something... I'll dig further

@psarna
Copy link
Contributor

psarna commented Sep 12, 2023

yeah, it's due to the fact we call futures::executor::block_on underneath, which clashes with single-threaded tokio runtime

@hangj
Copy link
Author

hangj commented Sep 13, 2023

Yeah, that's the reason.

But the real problem I think is that the libsql_client::SyncClient is not a real blocking client, I have to choose a runtime for it.

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

No branches or pull requests

2 participants