Closed nuel77 closed 2 months ago
This, indeed, is not supposed to happen.
Can you please provide a runnable minimal repro? I tried to write a quick test with many parallel inserts (I used some test helper functions from here):
#[tokio::test]
async fn does_not_panic_on_consequent_calls() {
let table_name = "does_not_panic_on_consequent_calls";
let client: Client = prepare_database!();
create_simple_table(&client, table_name).await;
const ITERATIONS: usize = 100;
const ROWS_PER_ITERATION: usize = 10_000;
let mut set = JoinSet::new();
for i in 0..ITERATIONS {
let client = client.clone();
set.spawn(async move {
insert_rows(&client, table_name, ROWS_PER_ITERATION, i).await;
});
}
while let Some(_) = set.join_next().await {
// ...
}
let rows = fetch_simple_rows(&client, table_name).await;
assert_eq!(rows.len(), ITERATIONS * ROWS_PER_ITERATION)
}
async fn insert_rows(client: &Client, table_name: &str, count: usize, iteration: usize) {
println!(
"[{}] Started inserting rows - iter {}",
OffsetDateTime::now_utc().to_string(),
iteration
);
let mut insert = client.insert(table_name).unwrap();
for _ in 0..count {
let row = random_row();
insert.write(&row).await.unwrap();
}
insert.end().await.unwrap();
println!(
"[{}] Inserted {} rows - iter {}",
OffsetDateTime::now_utc().to_string(),
count,
iteration
);
}
fn random_row() -> SimpleRow {
let mut rng = thread_rng();
SimpleRow::new(rng.gen(), rng.gen::<u32>().to_string())
}
But there are no panics, no matter how many iterations (or, more precisely, task count) or the number of rows per iteration are used.
Sample output:
Hey I was getting the same issues not sure why But when I revert my commit that isn't part of clickhouse
it just work.
thread 'tokio-runtime-worker' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clickhouse-0.12.2/src/insert.rs:90:18:
internal error: entered unreachable code
in my case I was using aya_ebpf to monitor my traffic and these panic cause show up on these change and it's just never panic after revert from this
diff --git a/analytics-ebpf/src/utils.rs b/analytics-ebpf/src/utils.rs
index 4bb16bb..3a77121 100644
--- a/analytics-ebpf/src/utils.rs
+++ b/analytics-ebpf/src/utils.rs
@@ -26,15 +26,54 @@ pub fn ptr_at<T>(ctx: &XdpContext, offset: usize) -> Result<&T, u32> {
pub fn is_our_ip(ip_addr: Ipv4Addr) -> bool {
matches!(
ip_addr.octets(),
- [103, ..]
- | [116, ..]
- | [45, ..]
- | [27, ..]
- | [43, ..]
- | [89, ..]
- | [92, ..]
- | [173, ..]
- | [191, ..]
+ [2, 254, 141, ..]
+ | [1, 254, 163, ..]
+ | [1, 254, 216, ..]
+ | [1, 230, 27, ..]
+ | [1, 239, 251, ..]
+ | [1, 249, 35, ..]
+ | [1, 64, 184, ..]
+ | [4, 64, 185, ..]
+ | [4, 64, 186, ..]
+ | [4, 64, 187, ..]
+ | [4, 128, 25, ..]
+ | [4, 128, 26, ..]
+ | [8, 213, 177, ..]
+ | [9, 63, 180, ..]
+ | [1, 27, 200, ..]
+ | [1, 27, 201, ..]
+ | [1, 27, 202, ..]
+ | [1, 27, 203, ..]
+ | [1, 52, 108, ..]
+ | [1, 52, 109, ..]
+ | [1, 70, 7, ..]
+ | [1, 78, 31, ..]
+ | [1, 86, 48, ..]
+ | [1, 86, 49, ..]
+ | [1, 86, 50, ..]
+ | [1, 86, 51, ..]
+ | [1, 132, 0, ..]
+ | [1, 132, 1, ..]
+ | [1, 132, 3, ..]
+ | [1, 169, 67, ..]
+ | [1, 216, 158, ..]
+ | [1, 216, 159, ..]
+ | [1, 230, 120, ..]
+ | [1, 230, 121, ..]
AND This code don't have anything to do with clickhouse
just filter some IP form kernel space via XDP BUT THIS MADE IT PANIC??
@slvrtrn , can you try calling the inserter.end() immedialty after starting the inserter.
let mut inserter = client.insert(table).unwrap();
inserter
.end()
.await
.context("cannot commit inserter for table {:table?}")?;
this happened to us when the iter() was empty in my code.
@slvrtrn , can you try calling the inserter.end() immedialty after starting the inserter.
let mut inserter = client.insert(table).unwrap(); inserter .end() .await .context("cannot commit inserter for table {:table?}")?;
this happened to us when the iter() was empty in my code.
This might be the case I've try added is_empty() check before insert and it work now!
using version : 0.12.2
Hello, After a few hundred consecutive writes, the client panics for no reason. maybe i am using this wrong. any help is appreciated. i am writing the the database using this function:
after some writes, the db panics with this error message:
this assertion from the crate is failing: