surrealdb / surrealdb.rs

SurrealDB driver for Rust
https://surrealdb.com
Apache License 2.0
64 stars 7 forks source link

Bug: Code freeze on signin for windows #18

Closed M-Saeb closed 1 year ago

M-Saeb commented 1 year ago

Describe the bug

When my code reaches the signin function it freezes, no response is returned.

Steps to reproduce

Run searreal DB with the following command

surreal start --log debug --user root --pass root memory

Write the following code in main.rs

use surrealdb_rs::param::Root;
use surrealdb_rs::protocol::Ws;
use surrealdb_rs::{Result, Surreal};

#[tokio::main]
async fn main() -> Result<()> {
    println!("sneaky");

    let client = Surreal::connect::<Ws>("localhost:8000").await?;

    println!("going dark");

    client
        .signin(Root {
            username: "root",
            password: "root",
        })
        .await?;

    println!("finish signing in");

    // Select a specific namespace and database
    client.use_ns("test").use_db("test").await?;

    println!("sat DB");

    Ok(())
}

The output from the surrealdb CLI is:

[2023-01-04 19:35:51] INFO  surreal::web 127.0.0.1:59640 GET /rpc HTTP/1.1 101 "-" 679.6µs

The output from cargo run is:

   Compiling users_micservice v0.1.0 (F:\Programming\Rust\users_micservice)
    Finished dev [unoptimized + debuginfo] target(s) in 3.11s
     Running `target\debug\users_micservice.exe`
sneaky
going dark

If I forcibly stopped the CLI server using ctrl+c than the cargo run is also stop

Error: Error { kind: Socket, message: "socket error; receiving on a closed channel" }
error: process didn't exit successfully: `target\debug\users_micservice.exe` (exit code: 1)

My Cargo.toml

[package]
name = "users_micservice"
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"] }
serde = "1.0.152"
serde_json = "1.0.91"
surrealdb-rs = { git = 'https://github.com/surrealdb/surrealdb.rs' }

Expected behaviour

to login normally

SurrealDB version

surreal 1.0.0-beta.8+20220930.c246533 for windows on x86_64

Contact Details

Mohammed.saeb98@hotmail.com

Is there an existing issue for this?

Code of Conduct

rushmorem commented 1 year ago

This means you are using an unsupported version of the server. You need v1.0.0-beta.8+20221030.c12a1cc or newer. Also note that this repo is now deprecated. Please use https://github.com/surrealdb/surrealdb instead. The client is now located there.

tobiemh commented 1 year ago

Now that the Rust client library is being merged with the surrealdb crate itself, I am going to close this issue!