Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CC907200C6C for ; Fri, 5 May 2017 14:07:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CB0D2160BAF; Fri, 5 May 2017 12:07:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1D6EC160B97 for ; Fri, 5 May 2017 14:07:09 +0200 (CEST) Received: (qmail 88934 invoked by uid 500); 5 May 2017 12:07:08 -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 88922 invoked by uid 99); 5 May 2017 12:07:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 May 2017 12:07:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 44111C0587 for ; Fri, 5 May 2017 12:07:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 3bdkHum9g3wV for ; Fri, 5 May 2017 12:07:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4BD115F567 for ; Fri, 5 May 2017 12:07:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7D453E01A8 for ; Fri, 5 May 2017 12:07:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3F5FF21DED for ; Fri, 5 May 2017 12:07:04 +0000 (UTC) Date: Fri, 5 May 2017 12:07:04 +0000 (UTC) From: "LI Changshu (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HTTPCLIENT-1478) https calls ignore http.socket.timeout during SSL Handshake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 05 May 2017 12:07:11 -0000 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15998229#comment-15998229 ] LI Changshu edited comment on HTTPCLIENT-1478 at 5/5/17 12:06 PM: ------------------------------------------------------------------ I encountered this issue on verson 4.5.2, and using a proxy to access a https host. The soTimeout is set as the following: {code:borderStyle=solid} RequestConfig.Builder requestConfigBuilder = RequestConfig.custom() .setConnectionRequestTimeout(30000) .setConnectTimeout(30000) .setSocketTimeout(30000); {code} It turns out that sock.getSoTimeout() is 0 while ssl handshaking (Set breakpoint at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.upgrade(DefaultHttpClientConnectionOperator.java:192). The problem is fixed as the following: {code:borderStyle=solid} PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); // Set soTimeout here to affect socketRead in the phase of ssl handshake. Note that // the RequestConfig.setSocketTimeout will take effect only after the ssl handshake completed. cm.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(30000).build()); {code} was (Author: ricolcs): I encountered this issue on verson 4.5.2, and using a proxy to access a https host. The soTimeout is set as the following: {code:borderStyle=solid} RequestConfig.Builder requestConfigBuilder = RequestConfig.custom() .setConnectionRequestTimeout(30000) .setConnectTimeout(30000) .setSocketTimeout(30000); {code} It turns out that sock.getSoTimeout() is 0 while ssl handshaking. (Set breakpoint at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.upgrade(DefaultHttpClientConnectionOperator.java:192)) The problem is fixed as the following: {code:borderStyle=solid} PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); // Set soTimeout here to affect socketRead in the phase of ssl handshake. Note that // the RequestConfig.setSocketTimeout will take effect only after the ssl handshake completed. cm.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(30000).build()); {code} > 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: HttpClient (classic) > 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.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org