-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer overflow due to timeout with Netty + Jersey #3500
Comments
@glassfishrobot Commented |
@glassfishrobot Commented do you have any opinion about what are reasonable defaults here? Also, proper solution to this one is to make these settings configurable.. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@brettkail-wk Commented --- server/src/main/java/org/glassfish/jersey/netty/httpserver/NettyResponseWriter.java
+++ server/src/main/java/org/glassfish/jersey/netty/httpserver/NettyResponseWriter.java
@@ -144,7 +144,7 @@ class NettyResponseWriter implements ContainerResponseWriter {
JerseyChunkedInput jerseyChunkedInput = new JerseyChunkedInput(ctx.channel());
if (HttpUtil.isTransferEncodingChunked(response)) {
- ctx.write(new HttpChunkedInput(jerseyChunkedInput)).addListener(FLUSH_FUTURE);
+ ctx.writeAndFlush(new HttpChunkedInput(jerseyChunkedInput));
} else {
ctx.write(new HttpChunkedInput(jerseyChunkedInput)).addListener(FLUSH_FUTURE);
} This only works if the client is reading at least one chunk per 10sec (perhaps reasonable). To fully fix, |
@jpommerening Commented Brett, did you come up with a workaround that does not require patching |
@brettkail-wk Commented |
@jpommerening Commented |
|
This is now a blocking issue for me, is there a workaround? I am having to drop and filter data because I can't get the buffer to stop overflowing. |
Not as far as I know. jersey/jersey#3791 would need to be applied. I'm no longer pursuing a fix since we stopped using Netty with Jersey. |
This affected us so badly we have now done the same and swapped to Grizzly for Jersey. I will keep watch on this ticket as swapping back (which is desirable as we also use gRPC) is fairly easy at the moment. |
Unfortunately, any PR made to to the original repository needs to be made again to this repository under the new conditions. |
This commit contains a rewritten implementation of Netty Jersey server and client with the following major changes: 1) Consume `ByteBuf`s from `HttpContent` as-is for processing. 2) Fixes major leak and timout issues reported in eclipse-ee4j#3500 , eclipse-ee4j#3568 and eclipse-ee4j#4286 3) Fixes a bug on reading 0-byte or 1-byte JSON content Signed-off-by: Venkat Ganesh [email protected]
This commit contains a rewritten implementation of Netty Jersey server and client with the following major changes: 1) Consume `ByteBuf`s from `HttpContent` as-is for processing, reduces a lot of overhead. 2) Fixes a bug on reading 0-byte or 1-byte JSON content 3) Add three new configurable `ChunkedInput` buffer properties through `jersey.ci.capacity`, `jersey.ci.read.timeout` and `jersey.ci.write.timeout` 4) Add configurable payload size through `jersey.max.http.request.entitySizeMb` , defaults to 50 Mb This change should fix some of the long pending bug reports in eclipse-ee4j#3500 , eclipse-ee4j#3568 and eclipse-ee4j#4286 . This may also resolve eclipse-ee4j#4285 Signed-off-by: Venkat Ganesh [email protected]
This commit contains a rewritten implementation of Netty Jersey server and client with the following major changes: 1) Consume `ByteBuf`s from `HttpContent` as-is for processing, reduces a lot of overhead. 2) Fixes a bug on reading 0-byte or 1-byte JSON content 3) Add three new configurable `ChunkedInput` buffer properties through `jersey.ci.capacity`, `jersey.ci.read.timeout` and `jersey.ci.write.timeout` 4) Add configurable payload size through `jersey.max.http.request.entitySizeMb` , defaults to 50 Mb This change should fix some of the long pending bug reports in eclipse-ee4j#3500 , eclipse-ee4j#3568 and eclipse-ee4j#4286 . This may also resolve eclipse-ee4j#4285 Signed-off-by: Venkat Ganesh [email protected]
This commit contains a rewritten implementation of Netty Jersey server and client with the following major changes: 1) Consume `ByteBuf`s from `HttpContent` as-is for processing, reduces a lot of overhead. 2) Fixes a bug on reading 0-byte or 1-byte JSON content 3) Add three new configurable `ChunkedInput` buffer properties through `jersey.ci.capacity`, `jersey.ci.read.timeout` and `jersey.ci.write.timeout` 4) Add configurable payload size through `jersey.max.http.request.entitySizeMb` , defaults to 50 Mb This change should fix some of the long pending bug reports in eclipse-ee4j#3500 , eclipse-ee4j#3568 and eclipse-ee4j#4286 . This may also resolve eclipse-ee4j#4285 Signed-off-by: Venkat Ganesh [email protected]
This commit contains a rewritten implementation of Netty Jersey server and client with the following major changes: 1) Consume `ByteBuf`s from `HttpContent` as-is for processing, reduces a lot of overhead. 2) Fixes a bug on reading 0-byte or 1-byte JSON content 3) Add three new configurable `ChunkedInput` buffer properties through `jersey.ci.capacity`, `jersey.ci.read.timeout` and `jersey.ci.write.timeout` 4) Add configurable payload size through `jersey.max.http.request.entitySizeMb` , defaults to 50 Mb This change should fix some of the long pending bug reports in eclipse-ee4j#3500 , eclipse-ee4j#3568 and eclipse-ee4j#4286 . This may also resolve eclipse-ee4j#4285 Signed-off-by: Venkat Ganesh [email protected]
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler` using `NettyTestContainerFactory`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler` using `NettyTestContainerFactory`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler` using `NettyTestContainerFactory`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler` using `NettyTestContainerFactory`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler` using `NettyTestContainerFactory`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
Current unit tests only validate Netty's `JerseyClientHandler` against a Grizzly http server. This commit adds test cases to validate the same using Netty's `JerseyServerHandler` using `NettyTestContainerFactory`. Also adding extra test cases to effectively validate the bug fixes for eclipse-ee4j#3500 and eclipse-ee4j#3568 (that is, these new test cases will fail if ran against the code base older than eclipse-ee4j#4312) Fixes eclipse-ee4j#3500 and eclipse-ee4j#3568 Signed-off-by: Venkat Ganesh <[email protected]>
When returning a large response using the Netty connector, a "Buffer overflow" error occurs. Switching from
jersey-container-netty-http
tojersey-container-grizzly2-http
resolves the issue, so it appears to be specific to the netty connector.Testing with a 521k response and Jersey 2.25.1, the buffer overflow occurs in org.glassfish.jersey.netty.connector.internal.JerseyChunkedInput#write at line 224. The revelant code is:
The queue has a capacity of 8, and the offer timeout is 1000ms, which seems low.
Relevant portion of the stack trace:
Environment
OpenJDK 1.8.0_121
Affected Versions
[2.25.1]
The text was updated successfully, but these errors were encountered: