Skip to content

0.7.0-rc.2 issue: "invalid utf-8 sequence of 1 bytes from index 34" #150

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

Closed
elimirks opened this issue Nov 23, 2023 · 3 comments
Closed

Comments

@elimirks
Copy link
Contributor

elimirks commented Nov 23, 2023

Version: 0.7.0-rc.2

I'm getting this error for a cypher query returning a lot of rows:

unexpected response for PULL: Err(DeserializationError(Other("invalid utf-8 sequence of 1 bytes from index 34")))

Seems to stem from line 81 in stream.rs.

@elimirks elimirks changed the title "invalid utf-8 sequence of 1 bytes from index 34" 0.7.0-rc.2 issue: "invalid utf-8 sequence of 1 bytes from index 34" Nov 23, 2023
@elimirks
Copy link
Contributor Author

    async fn read_chunk(&mut self, chunk_size: usize, buf: &mut BytesMut) -> Result<()> {
        let pos = buf.len();
        buf.resize(pos + chunk_size, 0);
        self.stream.read_exact(&mut buf[pos..]).await?;
        return Ok(());

        // This is an unsafe variant of doing the following
        // but skips the zero-initialization of the buffer
        //
        //     let pos = bytes.len();
        //     bytes.resize(pos + chunk_size, 0);
        //     self.stream.read_exact(&mut bytes[pos..]).await?;
        //
        // Alternatively, this an unsafe variant of the following except
        // it does read extactly `chunk_size` bytes and not maybe more
        //
        //     bytes.reserve(chunk_size);
        //     self.stream.read_buf(&mut bytes).await?;

Seems the unsafe version of this code is breaking something, doing this (as the comment suggested is safe) works fine

elimirks added a commit to elimirks/neo4rs that referenced this issue Nov 23, 2023
@elimirks
Copy link
Contributor Author

PR submitted: #151

@trentG92
Copy link

Ive written a couple of tests returning several thousand elements in an array result, and also returning map, this seems to fix all of the problems experienced in #149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants