Currently, the r2-netty client recycles connections once the response body has been fully received. However, it is possible for a server to return a response before fully consuming the request body. In this case, the channel will be recycled before the request body has made it through the pipeline. If a subsequent request comes in before the prior request is complete, an illegal state exception is thrown by the netty http object encoder.
I created a unit test to reproduce the issue and updated the lifecycle handler to recycle the channel only after both the request and response are complete.
Currently, the r2-netty client recycles connections once the response body has been fully received. However, it is possible for a server to return a response before fully consuming the request body. In this case, the channel will be recycled before the request body has made it through the pipeline. If a subsequent request comes in before the prior request is complete, an illegal state exception is thrown by the netty http object encoder.
I created a unit test to reproduce the issue and updated the lifecycle handler to recycle the channel only after both the request and response are complete.