[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14052835#comment-14052835
 ] 

Josip Gracin commented on HTTPCLIENT-1478:
------------------------------------------

I think I'm also having this problem, and using 4.3.4 does not help, it hangs 
forever.  I'm using something like this to instantiate Spring's RestTemplate:
    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
        <constructor-arg>
            <bean 
class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
                <property name="connectTimeout" value="10000" />
                <property name="readTimeout" value="10000" />
            </bean>
        </constructor-arg>
    </bean>

I start 'nc -l localhost:12000' to mock a non-responding server, and here's the 
log:

12:06:57.455 [scheduler-1] DEBUG o.a.h.c.protocol.RequestAddCookies - 
CookieSpec selected: best-match
12:06:57.480 [scheduler-1] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache 
not set in the context
12:06:57.484 [scheduler-1] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - 
Connection request: [route: {s}->https://localhost:12000][total kept alive: 0; 
route allocated: 0 of 5; total allocated: 0 of 10]
12:06:57.527 [scheduler-1] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - 
Connection leased: [id: 0][route: {s}->https://localhost:12000][total kept 
alive: 0; route allocated: 1 of 5; total allocated: 1 of 10]
12:06:57.531 [scheduler-1] DEBUG o.a.h.impl.execchain.MainClientExec - Opening 
connection {s}->https://localhost:12000
12:06:57.536 [scheduler-1] DEBUG o.a.h.i.c.HttpClientConnectionOperator - 
Connecting to localhost/127.0.0.1:12000

> https calls ignore http.socket.timeout during SSL Handshake
> -----------------------------------------------------------
>
>                 Key: HTTPCLIENT-1478
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1478
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpConn
>    Affects Versions: 4.3 Final, 4.3.1, 4.3.2, 4.3.3
>         Environment: All
>            Reporter: Jonah Schwartz
>            Priority: Minor
>             Fix For: 4.3.4
>
>
> https calls ignore http.socket.timeout during SSL Handshake. This can result 
> in a https call hanging forever waiting for socket read. 
> In both SSLSocketFactory and SSLConnectionSocketFactory, 
> sslsock.startHandshake(); is called before socket timeout is set on the 
> socket. This means timeout is not respected during the SSL handshake, and the 
> thread can hang with a stacktrace that looks like this:
> org.apache.http.impl.client.AbstractHttpClient.doExecute
> org.apache.http.impl.client.DefaultRequestDirector.execute
> org.apache.http.impl.client.DefaultRequestDirector.tryConnect
> org.apache.http.impl.conn.ManagedClientConnectionImpl.open
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection
> org.apache.http.conn.ssl.SSLSocketFactory.connectSocket
> org.apache.http.conn.ssl.SSLSocketFactory.connectSocket
> sun.security.ssl.SSLSocketImpl.startHandshake
> sun.security.ssl.SSLSocketImpl.startHandshake
> sun.security.ssl.SSLSocketImpl.performInitialHandshake
> sun.security.ssl.SSLSocketImpl.readRecord
> sun.security.ssl.InputRecord.read
> sun.security.ssl.InputRecord.readV3Record
> sun.security.ssl.InputRecord.readFully
> java.net.SocketInputStream.read
> java.net.SocketInputStream.socketRead0



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to