hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCORE-401) NHttpReverseProxy times out when forwarding to IP other than localhost
Date Mon, 04 May 2015 08:13:06 GMT

     [ https://issues.apache.org/jira/browse/HTTPCORE-401?page=com.atlassian.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├Ąck
>
> The NHttpReverseProxy often times out, resulting in the response "Empty reply from server"
even though I can see from the server logs that the response was submitted without any problems.
This only happens when the responding server is on a different IP, i.e. it never fails if
both proxy and the server is on the same machine.
> It looks like the proxy is listening to the wrong channel initially, as subsequent requests
to the same route seem to have a higher chance of succeeding.
> 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: 
> {quote}
> $ curl -v http://host1:8080/my-ping
> * STATE: INIT => CONNECT handle 0x600056480; line 1034 (connection #-5000)
> * STATE: CONNECT => WAITCONNECT handle 0x600056480; line 1087 (connection #0)
> * Connected to host1 (::1) port 8080 (#0)
> * STATE: WAITCONNECT => 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 => DO_DONE handle 0x600056480; line 1319 (connection #0)
> * STATE: DO_DONE => WAITPERFORM handle 0x600056480; line 1445 (connection #0)
> * STATE: WAITPERFORM => PERFORM handle 0x600056480; line 1458 (connection #0)
> * STATE: PERFORM => 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:53826
> [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 => CONNECT handle 0x600056480; line 1034 (connection #-5000)
> * STATE: CONNECT => WAITCONNECT handle 0x600056480; line 1087 (connection #0)
> * Connected to host1 (::1) port 8080 (#0)
> * STATE: WAITCONNECT => 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 => DO_DONE handle 0x600056480; line 1319 (connection #0)
> * STATE: DO_DONE => WAITPERFORM handle 0x600056480; line 1445 (connection #0)
> * STATE: WAITPERFORM => PERFORM handle 0x600056480; line 1458 (connection #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 => 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:53863
> [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


Mime
View raw message