You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Unsafe to set the length of the buffer, but we will fill it with read_exact
unsafe{
buf.set_len(new_len);
}
self.stream.read_exact(&mut buf[pos..]).await?;
Ok(())
}
}
The context is like this:
pos = 114662
chunk_size = 16381
new_len = 131043
*buf = (bytes::bytes_mut::BytesMut) {
ptr = (pointer = "removed for brevity")
len = 114662
cap = 131040
data = 0x0000000000000001
}
capacity < new_len so execution goes to buf.reserve()
new_len - buf.capacity() = 131043 - 131040 = 3
Here is the implemtation of buf.reserve():
#[inline]
pub fn reserve(&mut self, additional: usize) {
let len = self.len(); //114662
let rem = self.capacity() - len; // rem = 131040-114662 = 16378
// additional = 3, rem = 16378, so this function returns without allocate additional buffer.
if additional <= rem {
// The handle can already store at least `additional` more bytes, so
// there is no further work needed to be done.
return;
}
self.reserve_inner(additional);
}
Because capacity is still 131040, so application panics at line 165, here is the implementation of set_len()
#[inline]
pub unsafe fn set_len(&mut self, len: usize) {
// len = 131043, cap = 131040, assertion failed
debug_assert!(len <= self.cap, "set_len out of bounds");
self.len = len;
}
Side note: It only panics when the application read a specific row (row 247), the first 246 rows doesn't result panic.
MATCH (n:Label1)
RETURN n {.*,
sub: [ (n)-[:R]->(av) | av{.*}]
}
SKIP 246
LIMIT 1
The text was updated successfully, but these errors were encountered:
Hi team,
I encountered a strange error at line 165 in Connection::read_chunk()
neo4rs/lib/src/connection.rs
Lines 150 to 170 in a8c55c0
The context is like this:
Here is the implemtation of
buf.reserve()
:Because
capacity
is still131040
, so application panics at line165
, here is the implementation ofset_len()
Side note: It only panics when the application read a specific row (row 247), the first 246 rows doesn't result panic.
The text was updated successfully, but these errors were encountered: