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

Bug: Server panic when trying to remove namespace #3903

Open
2 tasks done
szabgab opened this issue Apr 17, 2024 · 0 comments
Open
2 tasks done

Bug: Server panic when trying to remove namespace #3903

szabgab opened this issue Apr 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working triage This issue is new

Comments

@szabgab
Copy link

szabgab commented Apr 17, 2024

Describe the bug

Running a server in Docker and accessing it with a program written in Rust. REMOVE NAMESPACE test will generate a panic in the server.

Steps to reproduce

Run server: docker run --rm --name my-surrealdb1 -p 8000:8000 --user root -v my-surreal-db:/database surrealdb/surrealdb:latest start --log trace file://database

Running the client:

$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/foreign-key`
before
connected
Error: Api(InternalError("receiving on a closed channel"))

Client code:

use surrealdb::engine::remote::ws::Ws;
use surrealdb::Surreal;

#[tokio::main]
async fn main() -> surrealdb::Result<()> {
    println!("before");
    let db = Surreal::new::<Ws>("127.0.0.1:8000").await?;
    println!("connected");

    let response = db.query("REMOVE NAMESPACE test").await?;
    response.check()?;

    Ok(())
}

Cargo.toml

[package]
name = "foreign-key"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
surrealdb = "1.4.0"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }

Full server log

2024-04-17T18:12:46.155861Z  INFO surreal::env: Running 1.4.0 for linux on x86_64
2024-04-17T18:12:46.155886Z DEBUG surreal::dbs: Database strict mode is false
2024-04-17T18:12:46.155897Z  WARN surreal::dbs: ❌🔒 IMPORTANT: Authentication is disabled. This is not recommended for production use. 🔒❌
2024-04-17T18:12:46.155914Z DEBUG surreal::dbs: Server capabilities: scripting=false, guest_access=false, live_query_notifications=true, allow_funcs=all, deny_funcs=none, allow_net=none, deny_net=none
2024-04-17T18:12:46.155941Z  INFO surrealdb_core::kvs::ds: Starting kvs store at file://database

...

2024-04-17T18:12:46.239675Z  INFO surrealdb_core::kvs::ds: Started kvs store at file://database
2024-04-17T18:12:46.239724Z TRACE surrealdb_core::kvs::ds: Clearing unreachable state
2024-04-17T18:12:46.239855Z TRACE surrealdb_core::kvs::ds: Found 1 nodes
2024-04-17T18:12:46.239879Z TRACE surrealdb_core::kvs::ds: Found 1 heartbeats
2024-04-17T18:12:46.239889Z TRACE surrealdb_core::kvs::ds: Found 0 node live queries
2024-04-17T18:12:46.239897Z TRACE surrealdb_core::kvs::ds: Found 0 table live queries
2024-04-17T18:12:46.239899Z TRACE surrealdb_core::kvs::ds: Successfully cleared cluster of unreachable state
2024-04-17T18:12:46.239981Z TRACE surrealdb_core::kvs::ds: Bootstrapping 'e2604fb5-fdfd-44ed-884f-62a726ad2624'
2024-04-17T18:12:46.240018Z TRACE surrealdb_core::kvs::ds: Registering node 'e2604fb5-fdfd-44ed-884f-62a726ad2624'
2024-04-17T18:12:46.240079Z TRACE surrealdb_core::kvs::tx: delr_hb: ts=[Hb { __: 47, _a: 33, _b: 104, _c: 98, hb: Timestamp { value: 1713368372254 }, _d: 47, nd: febacc64-be92-41bf-bbf0-07bf702297c4 }] limit=100000
2024-04-17T18:12:46.240096Z TRACE surrealdb_core::kvs::ds: Found 1 expired heartbeats
2024-04-17T18:12:46.240098Z TRACE surrealdb_core::kvs::ds: Deleting node febacc64-be92-41bf-bbf0-07bf702297c4
2024-04-17T18:12:46.240100Z TRACE surrealdb_core::kvs::ds: Archiving dead nodes: [Uuid(febacc64-be92-41bf-bbf0-07bf702297c4)]
2024-04-17T18:12:46.240103Z TRACE surrealdb_core::kvs::ds: Archiving node 'febacc64-be92-41bf-bbf0-07bf702297c4'
2024-04-17T18:12:46.240108Z TRACE surrealdb_core::kvs::ds: Found 0 LQ entries for Uuid(febacc64-be92-41bf-bbf0-07bf702297c4)
2024-04-17T18:12:46.240202Z TRACE surrealdb_core::kvs::ds: Gone into removing archived: 0
2024-04-17T18:12:46.240275Z DEBUG surrealdb_core::dbs::lifecycle: Started node agent initialisation
2024-04-17T18:12:46.240281Z TRACE surrealdb::api::engine::tasks: Ticker interval is 1s
2024-04-17T18:12:46.240293Z DEBUG surrealdb_core::dbs::lifecycle: Stopped node agent initialisation
2024-04-17T18:12:46.240327Z DEBUG surrealdb_core::dbs::lifecycle: Started heartbeat task
2024-04-17T18:12:46.240370Z DEBUG surrealdb_core::dbs::lifecycle: Started live query agent task
2024-04-17T18:12:46.240415Z DEBUG surrealdb_core::dbs::lifecycle: Stopped live query agent task
2024-04-17T18:12:46.240516Z  INFO surrealdb::net: Started web server on 0.0.0.0:8000
2024-04-17T18:12:47.241756Z TRACE surrealdb::api::engine::tasks: Node agent tick: Instant { tv_sec: 122383, tv_nsec: 440845751 }
2024-04-17T18:12:47.241794Z TRACE surrealdb_core::kvs::ds: Ticking at timestamp 1713377567
2024-04-17T18:12:48.241018Z TRACE surrealdb::api::engine::tasks: Node agent tick: Instant { tv_sec: 122384, tv_nsec: 440845751 }
2024-04-17T18:12:48.241042Z TRACE surrealdb_core::kvs::ds: Ticking at timestamp 1713377568
2024-04-17T18:12:49.240776Z TRACE surrealdb::api::engine::tasks: Node agent tick: Instant { tv_sec: 122385, tv_nsec: 440845751 }
2024-04-17T18:12:49.240812Z TRACE surrealdb_core::kvs::ds: Ticking at timestamp 1713377569
2024-04-17T18:12:49.484121Z DEBUG request: surreal::net::tracer: started processing request otel.kind="server" http.request.method="GET" url.path="/rpc" network.protocol.name="http" network.protocol.version="1.1" otel.name="GET /rpc" http.route="/rpc" http.request.id="24312de8-bfe4-4dff-ab67-1fc43968c0c1" client.address="172.17.0.1"
2024-04-17T18:12:49.484216Z DEBUG request: surreal::net::tracer: finished processing request otel.kind="server" http.request.method="GET" url.path="/rpc" network.protocol.name="http" network.protocol.version="1.1" otel.name="GET /rpc" http.route="/rpc" http.request.id="24312de8-bfe4-4dff-ab67-1fc43968c0c1" client.address="172.17.0.1" http.response.body.size="0" http.response.status_code=101 http.latency.ms=0
2024-04-17T18:12:49.484311Z TRACE surreal::rpc::connection: WebSocket 24312de8-bfe4-4dff-ab67-1fc43968c0c1 connected
2024-04-17T18:12:49.484865Z DEBUG rpc/call: surreal::rpc::connection: Process RPC request otel.kind="server" ws.id=24312de8-bfe4-4dff-ab67-1fc43968c0c1 rpc.service="surrealdb" rpc.method="version" otel.name="surrealdb.rpc/version" rpc.request_id="0"
2024-04-17T18:12:49.484886Z DEBUG rpc/call: surreal::rpc::response: Process RPC response otel.kind="server" ws.id=24312de8-bfe4-4dff-ab67-1fc43968c0c1 rpc.service="surrealdb" rpc.method="version" otel.name="surrealdb.rpc/version" rpc.request_id="0"
2024-04-17T18:12:49.485498Z DEBUG request: surreal::net::tracer: started processing request otel.kind="server" http.request.method="GET" url.path="/rpc" network.protocol.name="http" network.protocol.version="1.1" otel.name="GET /rpc" http.route="/rpc" http.request.id="fe8439ce-a516-44d6-ba1b-9b49dea73cf3" client.address="172.17.0.1"
2024-04-17T18:12:49.485521Z DEBUG request: surreal::net::tracer: finished processing request otel.kind="server" http.request.method="GET" url.path="/rpc" network.protocol.name="http" network.protocol.version="1.1" otel.name="GET /rpc" http.route="/rpc" http.request.id="fe8439ce-a516-44d6-ba1b-9b49dea73cf3" client.address="172.17.0.1" http.response.body.size="0" http.response.status_code=101 http.latency.ms=0
2024-04-17T18:12:49.485571Z TRACE surreal::rpc::connection: WebSocket fe8439ce-a516-44d6-ba1b-9b49dea73cf3 connected
2024-04-17T18:12:49.485788Z TRACE surreal::rpc::connection: WebSocket 24312de8-bfe4-4dff-ab67-1fc43968c0c1 disconnected
2024-04-17T18:12:49.532332Z DEBUG rpc/call: surreal::rpc::connection: Process RPC request otel.kind="server" ws.id=fe8439ce-a516-44d6-ba1b-9b49dea73cf3 rpc.service="surrealdb" rpc.method="query" otel.name="surrealdb.rpc/query" rpc.request_id="0"
2024-04-17T18:12:49.532485Z DEBUG rpc/call:process:executor: surrealdb_core::dbs::executor: Executing: REMOVE NAMESPACE test otel.kind="server" ws.id=fe8439ce-a516-44d6-ba1b-9b49dea73cf3 rpc.service="surrealdb" rpc.method="query" otel.name="surrealdb.rpc/query" rpc.request_id="0"
thread 'surrealdb-worker' panicked at core/src/dbs/options.rs:355:45:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behaviour

The server should not crash

SurrealDB version

Running 1.4.0 for linux on x86_64

Contact Details

gabor@szabgab.com

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@szabgab szabgab added bug Something isn't working triage This issue is new labels Apr 17, 2024
@gguillemas gguillemas self-assigned this Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue is new
Projects
None yet
Development

No branches or pull requests

2 participants