ari-ban / issue-test

0 stars 0 forks source link

"java.io.IOException: Remotely closed" in HTTPS (AHC) #1939

Closed arinban closed 7 years ago

arinban commented 7 years ago

I use Grizzly 2.3.30 + AHC 1.9.40.

When the HTTPS Server didn't support Keep-Alive(connection=close), the grizzly http client(AHC) failed to parse the last packet of response.

java.util.concurrent.ExecutionException: java.io.IOException: Remotely 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)

When I debug the SSLBaseFilter#unwrapAll, I could see some strange status of buffers.

https://github.com/javaee/grizzly/blob/2.3.x/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java#L432 and https://github.com/javaee/grizzly/blob/2.3.x/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java#L436

https://github.com/javaee/grizzly/blob/2.3.x/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java#L423

https://github.com/javaee/grizzly/blob/2.3.x/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java#L465

I think SSLEngine already read the last packet(result.output) but local output didn't be assigned in SSL termination because of https://github.com/javaee/grizzly/blob/2.3.x/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java#L436.

Unfortunately, I couldn't reproduce it with simple testcase but sometimes I met it in production environment.

arinban commented 6 years ago
arinban commented 7 years ago

@carryel Commented When I tried to fix it simply like this(https://github.com/carryel/grizzly/blob/2.3.x/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java#L423L445), I didn't met the error.

arinban commented 7 years ago

@rlubke Commented @carryel Could you create a pull request?

arinban commented 7 years ago

@carryel Commented @rlubke Sure. I just create a PR. https://github.com/javaee/grizzly/pull/1940

arinban commented 7 years ago

@rlubke Commented @carryel I've merged the PR. I'll take care of porting to 2.4.x and master.

arinban commented 7 years ago

@carryel Commented @rlubke Thanks! Perhaps could I know when the next release of 2.3.x will be able?

arinban commented 7 years ago

@rlubke Commented @carryel Most likely by the end of the week.

arinban commented 7 years ago

@rlubke Commented @carryel I'm not sure if you've subscribed to the new discussion group, but 2.3.31 has been released.

arinban commented 7 years ago

@carryel Commented @rlubke Thanks a lot. I already subscribed. :-)