Skip to content

Complete ResponseCallbackWrapper on encoding failure#127

Open
Denovo1998 wants to merge 1 commit intodatastax:4.0_dsfrom
Denovo1998:netty-memory-leak-writeAndFlushResponseToClient
Open

Complete ResponseCallbackWrapper on encoding failure#127
Denovo1998 wants to merge 1 commit intodatastax:4.0_dsfrom
Denovo1998:netty-memory-leak-writeAndFlushResponseToClient

Conversation

@Denovo1998
Copy link

https://github.com/Denovo1998/starlight-for-kafka/actions/runs/20877709389?pr=1

Motivation

ResponseCallbackWrapper is used to run cleanup logic after a response is written to the network channel. When KafkaCommandDecoder fails to convert a response to ByteBuf, we currently send an error response but never invoke the wrapper’s completion callback, which can leave cleanup logic unexecuted and potentially leak in-flight request state. This PR ensures the callback is completed on the failure path as well, and aligns the related fetch test to always complete the wrapper after inspection.

Modifications

  • Call ResponseCallbackWrapper#responseComplete() when responseToByteBuf throws, before sending an error response.
  • Update KafkaApisTest#testFetchMinBytesSingleConsumer to always invoke responseComplete() in a finally block after asserting on the wrapped response.

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

Successfully merging this pull request may close these issues.

1 participant