tychedelia/kafka-protocol-rs

Decoding failures

thedodd opened this issue · 1 comments

I have a basic implementation of a server which is able to successfully parse header requests; however, when attempting to proceed with parsing ApiVersionsRequests, MetadataRequests and ProduceRequests, decoding fails at various different locations for each. This is true with:

I'm happy to proceed with testing other clients, maybe a few from other languages. However, just to provide some concrete examples:

  • When attempting to decode PartitionProduceData in the impl Decodable for PartitionProduceData block, decoding fails to decode records as types::Bytes.decode(buf)?, because it attempts to parse a length first, and in the cases I've been debugging, the length includes the 4 bytes describing the length. So when this crate attempts to decode those bytes, it always sees the payload as being 4 bytes too short. I'll need to dig a bit deeper to see if there is an easy fix.
  • In another example, attempting to decode an ApiVersionsRequest, decoding fails on the client_software_version as a types::CompactString.decode(buf)?. The following line: let strbuf = StrBytes::try_from(buf.try_get_bytes((n - 1) as usize)?)?; fails, also due to a length vs buffer length mismatch.

Disregard. Error in my code.