suharev7 / clickhouse-rs

Asynchronous ClickHouse client library for Rust programming language.
MIT License
324 stars 121 forks source link

Panics in query_result #220

Open serega opened 5 months ago

serega commented 5 months ago

Get occasional panics in query_result

thread 'tokio-runtime-worker' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/clickhouse-rs-1.1.0-alpha.1/src/types/query_result/mod.rs:93:44:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

will set RUST_BACKTRACE to get more info. The program makes a single call repeatedly in a loop, so it looks roughly as so

async fn fetch_data(client: &mut ClientHandle) -> Result<...> {
 let block = client
        .query(query.as_str())
        .fetch_all().await?;
...
}

let mut handle = self.client.get_handle().await.unwrap();
loop {
    let data = fetch_data(&mut handle);
    ...
}

The crash is not frequent. It may work for a couple of hours or couple of days before crashing. There were no errors reported from previous query calls