Skip to content

Grizzly: Connection closing causes Future get() to fail #1209

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

Closed
afelisatti opened this issue Jul 12, 2016 · 5 comments
Closed

Grizzly: Connection closing causes Future get() to fail #1209

afelisatti opened this issue Jul 12, 2016 · 5 comments

Comments

@afelisatti
Copy link

afelisatti commented Jul 12, 2016

After updating Grizzly to the latest version, we found that the handling of the server response sometimes fails when sending a "Connection: keep-alive" header in the request and receiving a "Connection: close" in the response over HTTPS.
I've added a test that reproduces the issue for the Grizzly provider in #1208 with Grizzly version 2.3.25, but the issue starts at version 2.3.22. I suspect it might have something to do with the fix for https://java.net/jira/browse/GRIZZLY-1780 which was introduced on that version.
To reproduce, run the test a couple of times. Upon failure the following error is seen:

2016-07-12 17:34:46,757 [AsyncHttpClient-Callback] DEBUG com.ning.http.client.AsyncCompletionHandlerBase - Locally closed
java.io.IOException: Locally closed
java.util.concurrent.ExecutionException: java.io.IOException: Locally closed
at org.glassfish.grizzly.impl.SafeFutureImpl$Sync.innerGet(SafeFutureImpl.java:349)
at org.glassfish.grizzly.impl.SafeFutureImpl.get(SafeFutureImpl.java:255)
at com.ning.http.client.providers.grizzly.GrizzlyResponseFuture.get(GrizzlyResponseFuture.java:127)
at com.ning.http.client.async.ConnectionCloseTest.handlesCloseResponse(ConnectionCloseTest.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
at org.testng.SuiteRunner.run(SuiteRunner.java:254)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.io.IOException: Locally closed
2016-07-12 17:34:46,761 [AsyncHttpClient-Callback] DEBUG com.ning.http.client.providers.grizzly.AhcEventFilter - RESPONSE: HttpResponsePacket (
status=200
reason=OK
protocol=HTTP/1.1
content-length=-1
committed=false
headers=[
connection=close
server=Jetty(8.1.1.v20120215)]
)

@oleksiys
Copy link
Contributor

Hi Ana,
could you pls. check if it's still the case with the latest 2.3.26-SNAPSHOT?

@afelisatti
Copy link
Author

Hi, @oleksiys.
I have indeed verified it works with 2.3.26-SNAPSHOT. I'll leave my PR open until the version can be changed to 2.3.26. However, testing has revealed another problem on the Grizzly server side using that snapshot. I will do some more testing and follow up on that with a Grizzly Jira issue.
Thanks!

@afelisatti
Copy link
Author

Just added my findings to https://java.net/jira/browse/GRIZZLY-1833 (seems that fixed introduced a regression).

@slandelle
Copy link
Contributor

Closed by #1208

@jeff303
Copy link

jeff303 commented Jul 21, 2017

I believe we are encountering this issue on Jersey 2.23.1. But I'm a bit lost here, and struggling to make sense of the fixed version and accompanying notes. I notice that the Jira site linked to by https://java.net/jira/browse/GRIZZLY-1833 is closed now, and there is no obvious redirect. I am unable to find that issue, in its new home, to read through the aforementioned findings. Can anyone point me to that? Thanks.

Edit: I just realized that the Jira numbers exactly correspond to Github issue numbers. So javaee/grizzly#1833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants