Skip to content

The Netty JerseyServerHandler does not reset entity stream between requests. #4575

@everett1992

Description

@everett1992

JerseyServerHandler uses the same NettyInputStream across all messages and if a request does not close it's entity input stream a chunk of it's data will be visible to the next request on the same channel.

The handler tries to reset the inputStream between messages by calling nettyInputStream.clear

https://github.com/eclipse-ee4j/jersey/blob/master/containers/netty-http/src/main/java/org/glassfish/jersey/netty/httpserver/JerseyServerHandler.java#L83

However clear does not fully reset the NettyInputStream. It does not null out buffer or current so the next call to read will return data from buffer which is data from the previous call.

Clear should be fixed. It should null cause, reading, buffer, and current. It may be appropriate to notifyAll and cleanup buffers in isList. You could also or instead allocate a new NettyInputStream instead of reusing the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions