Skip to content

jersey-netty-connector Stuck eventLoop/ExecuterService threads if Request failed due to invalid header key or value. #5836

@sumitaneja

Description

@sumitaneja

NettyConnector doesn't completes/release executorService threads executor and may even lead to stuck evetLoop under stress if headerKey is invalid (say blank) and error happens in netty while validating those. (reproducer attached)

Issue identified in below code with NettyConnector

jerseyRequest.setStreamProvider(new OutboundMessageContext.StreamProvider() {
@Override
public OutputStream getOutputStream(int contentLength) throws IOException {
replaceHeaders(jerseyRequest, nettyRequest.headers()); // WriterInterceptor changes
setHostHeader(jerseyRequest, nettyRequest);
headersSet.countDown();
return entityWriter.getOutputStream();
}
});

Here if any exception happens, below code doesn't get executed leading to stuck executorService threads.

This code needs to be fail safe wrapped under try catch with finally countDown the latch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions