jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

HttpChannelState does not satisfy the contract of Content.Source

Open scrat98 opened this issue 1 year ago • 2 comments

Jetty version(s) 12.0.11

Jetty Environment any

Java version/vendor (use: java -version) any

OS type/version any

Description Fail method contract: If read() has returned a last chunk, this is a no operation.

How to reproduce? Relates to https://github.com/jetty/jetty.project/pull/11804 Remove if clause and run HttpChannelTest https://github.com/jetty/jetty.project/pull/11804/files#diff-a2016d36a06123b85fc4e54ab2467b6cfbe51398c8fd624706d1dae9fc3c4e29R231

scrat98 avatar Jun 05 '24 22:06 scrat98

We are throwing a "content read fully exception".

gregw avatar Jun 06 '24 06:06 gregw

@sbordet @lorban I think this is indeed outside of the contract. Not only do we act on a call to HttpChannel.ChannelRequest#failed(Throwable) after all the content is read, but we simply call HttpChannelState.onFailure(Throwable), which is a much more significant failure as it also fails the write side. I guess we should be able to fail the read side and continue writing content to the response?

I'm not seeing an immediate easy fix.

Note you can also reproduce in my branch: #11849 in a similar way

gregw avatar Jun 06 '24 07:06 gregw