ari-ban / issue-test

0 stars 0 forks source link

Exception thrown when sending request through proxy and receiving a close #1923

Closed arinban closed 7 years ago

arinban commented 7 years ago

We have a grizzly provider set up to use a proxy to hit an HTTPS server. We can see the CONNECT being successful and the request start being processed. However, when it's done an "HTTP keep-alive was disabled for this connection" exception is thrown, causing the Future awaiting the response to fail. This only occurs when the server responds with a "Connection: close" header. We have found this was working in version 1.9.31 but broke somewhere in between 1.9.39. The change seems to be in line 103 of HttpTransactionContext which added the abort:

        @Override
        public void onClosed(Closeable closeable, CloseType type) throws IOException {
            if (isGracefullyFinishResponseOnClose()) {
                // Connection was closed.
                // This event is fired only for responses, which don't have
                // associated transfer-encoding or content-length.
                // We have to complete such a request-response processing gracefully.
                final FilterChain fc = (FilterChain) connection.getProcessor();
                fc.fireEventUpstream(connection,
                        new GracefulCloseEvent(HttpTransactionContext.this), null);
            } else if (CloseType.REMOTELY.equals(type)) {
                abort(AsyncHttpProviderUtils.REMOTELY_CLOSED_EXCEPTION);
            } else {
                try {
                    closeable.assertOpen();
                } catch (IOException ioe) {
                    // unwrap the exception as it was wrapped by assertOpen.
                    abort(ioe.getCause());
                }
            }
        }
    };
arinban commented 6 years ago
arinban commented 7 years ago

@rlubke Commented Tracking here: https://github.com/javaee/grizzly-ahc/issues/2