hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Choina (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1764) SocketTimeout cannot be set on per request basis when using Proxy and SSL
Date Tue, 30 Aug 2016 09:12:20 GMT
Sebastian Choina created HTTPCLIENT-1764:

             Summary: SocketTimeout cannot be set on per request basis when using Proxy and
                 Key: HTTPCLIENT-1764
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1764
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.5.2
            Reporter: Sebastian Choina

I have ran into the same problem described in HTTPCLIENT-1478 and IMHO it should not be closed.

Right now there is no way to set {{soTimeout}} for http tunnel establish phase causing client
to hang forever in case of bad proxy. 

The workaround is to set {{defaultSockedConfig}} upon creation of the client. However IMHO,
client should honor {{RequestConfig#SocketTimeout}} in this case, and if not, developer should
have the ability to set {{soTimeout}} for this particular phase on request basis as well.

Setting default configuration is one workaround, but if I would need timeout value to vary
across the requests, I would have to create new client for each one and that is against the
desing of reusebility of the client itself.

Here is the wire log on hanging connection. As for the time of writing, scenerio (inf. hang)
is reproducable using proxy from the logs.

09:55:06.719 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.c.protocol.RequestAddCookies
- CookieSpec selected: default
09:55:06.720 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.c.protocol.RequestAuthCache
- Auth cache not set in the context
09:55:06.721 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager
- Connection request: [route: {tls}->>https://api.ipify.org:443][total
kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
09:55:06.722 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager
- Connection leased: [id: 19][route: {tls}->>https://api.ipify.org:443][total
kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
09:55:06.723 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.impl.execchain.MainClientExec
- Opening connection {tls}->>https://api.ipify.org:443
09:55:06.723 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator
- Connecting to /
09:55:06.786 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator
- Connection established<->
09:55:06.787 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.headers -
http-outgoing-19 >> CONNECT api.ipify.org:443 HTTP/1.1
09:55:06.787 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.headers -
http-outgoing-19 >> Host: api.ipify.org
09:55:06.788 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.headers -
http-outgoing-19 >> User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_66)
09:55:06.788 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.wire - http-outgoing-19
>> "CONNECT api.ipify.org:443 HTTP/1.1[\r][\n]"
09:55:06.788 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.wire - http-outgoing-19
>> "Host: api.ipify.org[\r][\n]"
09:55:06.789 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.wire - http-outgoing-19
>> "User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_66)[\r][\n]"
09:55:06.789 [ProxyPool-ScheduledWorkers-pool-3-thread-1] DEBUG org.apache.http.wire - http-outgoing-19
>> "[\r][\n]"

Workaround to force timeout:
		client = HttpClients.custom()// the same as createDefault();
				.disableAutomaticRetries() // we dont want this test to take too long

If we remove default socket config, client will hang

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message