Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4EC2517F07 for ; Mon, 4 May 2015 08:13:06 +0000 (UTC) Received: (qmail 149 invoked by uid 500); 4 May 2015 08:13:06 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 116 invoked by uid 500); 4 May 2015 08:13:06 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 105 invoked by uid 99); 4 May 2015 08:13:06 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2015 08:13:06 +0000 Date: Mon, 4 May 2015 08:13:06 +0000 (UTC) From: "Oleg Kalnichevski (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (HTTPCORE-401) NHttpReverseProxy times out when forwarding to IP other than localhost MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCORE-401?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski resolved HTTPCORE-401. ---------------------------------------- Resolution: Cannot Reproduce Jesper, Please re-open the issue if there are new findings. Oleg > NHttpReverseProxy times out when forwarding to IP other than localhost > ---------------------------------------------------------------------- > > Key: HTTPCORE-401 > URL: https://issues.apache.org/jira/browse/HTTPCORE-401 > Project: HttpComponents HttpCore > Issue Type: Bug > Components: Examples > Affects Versions: 4.4.1 > Reporter: Jesper Hammarb=C3=A4ck > > The NHttpReverseProxy often times out, resulting in the response "Empty r= eply from server" even though I can see from the server logs that the respo= nse was submitted without any problems. This only happens when the respondi= ng server is on a different IP, i.e. it never fails if both proxy and the s= erver is on the same machine. > It looks like the proxy is listening to the wrong channel initially, as s= ubsequent requests to the same route seem to have a higher chance of succee= ding. > I did the following: > * svn co http://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.4= .1 > * mvn clean install > * Started a simple HTTP server on my "host2:12345" > * Opened httpcore-nio\pom.xml in my IDE and started NHttpReverseProxy on = my "host1" with parameters "http://host2:12345 8080" > I executed curl:=20 > {quote} > $ curl -v http://host1:8080/my-ping > * STATE: INIT =3D> CONNECT handle 0x600056480; line 1034 (connection #-50= 00) > * STATE: CONNECT =3D> WAITCONNECT handle 0x600056480; line 1087 (connecti= on #0) > * Connected to host1 (::1) port 8080 (#0) > * STATE: WAITCONNECT =3D> DO handle 0x600056480; line 1233 (connection #0= ) > > GET /my-ping HTTP/1.1 > > User-Agent: curl/7.38.0 > > Host: host1:8080 > > Accept: */* > > > * STATE: DO =3D> DO_DONE handle 0x600056480; line 1319 (connection #0) > * STATE: DO_DONE =3D> WAITPERFORM handle 0x600056480; line 1445 (connecti= on #0) > * STATE: WAITPERFORM =3D> PERFORM handle 0x600056480; line 1458 (connecti= on #0) > * STATE: PERFORM =3D> DONE handle 0x600056480; line 1628 (connection #0) > * Empty reply from server > * Connection #0 to host host1 left intact > curl: (52) Empty reply from server > {quote} > The output from NHttpReverseProxy was: > {quote} > [client->proxy] connection open 0:0:0:0:0:0:0:1:8080<->0:0:0:0:0:0:0:1:53= 826 > [client->proxy] 00000013 GET /my-ping HTTP/1.1 > [client->proxy] 00000013 request completed > [proxy->origin] connection open host1:53827<->host2:12345 > [proxy->origin] 00000013 GET /my-ping HTTP/1.1 > [client->proxy] connection closed 0.0.0.0:8080<->0:0:0:0:0:0:0:1:53826 > [proxy->origin] 00000013 request completed > [client<-proxy] 00000013 java.net.SocketTimeoutException > [proxy->origin] connection released host1:53827<->host2:12345 > [proxy->origin] [total kept alive: 0; total allocated: 0 of 100] > [proxy->origin] connection closed 0.0.0.0:53827<->host2:12345 > {quote} > I then executed the curl again and got following successful answer: > {quote} > $ curl -v http://host1:8080/my-ping > * STATE: INIT =3D> CONNECT handle 0x600056480; line 1034 (connection #-50= 00) > * STATE: CONNECT =3D> WAITCONNECT handle 0x600056480; line 1087 (connecti= on #0) > * Connected to host1 (::1) port 8080 (#0) > * STATE: WAITCONNECT =3D> DO handle 0x600056480; line 1233 (connection #0= ) > > GET /my-ping HTTP/1.1 > > User-Agent: curl/7.38.0 > > Host: host1:8080 > > Accept: */* > > > * STATE: DO =3D> DO_DONE handle 0x600056480; line 1319 (connection #0) > * STATE: DO_DONE =3D> WAITPERFORM handle 0x600056480; line 1445 (connecti= on #0) > * STATE: WAITPERFORM =3D> PERFORM handle 0x600056480; line 1458 (connecti= on #0) > * HTTP 1.1 or later with persistent connection, pipelining supported > < HTTP/1.1 200 OK > < Date: Wed, 22 Apr 2015 14:41:02 GMT > * Server Test/1.1 is not blacklisted > < Server: Test/1.1 > < Content-Length: 31 > < Content-Type: application/json > < > * STATE: PERFORM =3D> DONE handle 0x600056480; line 1628 (connection #0) > * Connection #0 to host host1 left intact > {"timestamp": "1429713663916" } > {quote} > The output from the proxy server: > {quote} > [client->proxy] connection open 0:0:0:0:0:0:0:1:8080<->0:0:0:0:0:0:0:1:53= 863 > [client->proxy] 00000014 GET /my-ping HTTP/1.1 > [client->proxy] 00000014 request completed > [proxy->origin] connection open host1:53864<->host2:12345 > [proxy->origin] 00000014 GET /my-ping HTTP/1.1 > [proxy->origin] 00000014 request completed > [proxy<-origin] 00000014 HTTP/1.1 200 OK > [client<-proxy] 00000014 response triggered > [client<-proxy] 00000014 HTTP/1.1 200 OK > [proxy->origin] connection kept alive host1:53864<->host2:12345 > [proxy<-origin] 00000014 31 bytes read > [proxy<-origin] 00000014 content fully read > [proxy<-origin] 00000014 response completed > [proxy->origin] connection released host1:53864<->host2:12345 > [proxy->origin] [total kept alive: 1; total allocated: 1 of 100] > [client<-proxy] 00000014 31 bytes written > [client<-proxy] 00000014 content fully written > [client<-proxy] 00000014 response completed > [client->proxy] connection kept alive 0:0:0:0:0:0:0:1:8080<->0:0:0:0:0:0:= 0:1:53863 > [client->proxy] connection closed 0.0.0.0:8080<->0:0:0:0:0:0:0:1:53863 > {quote} > A couple of seconds later the following is printed on the proxy console: > {quote} > [proxy->origin] connection closed 0.0.0.0:53864<->host2:12345 > {quote} > After that the next request fails again. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org