Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 12B2010E8A for ; Thu, 8 Jan 2015 23:45:34 +0000 (UTC) Received: (qmail 46425 invoked by uid 500); 8 Jan 2015 23:45:35 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 46332 invoked by uid 500); 8 Jan 2015 23:45:35 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 46320 invoked by uid 99); 8 Jan 2015 23:45:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jan 2015 23:45:35 +0000 Date: Thu, 8 Jan 2015 23:45:35 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (NET-552) SocketTimeoutException connecting a FTP server via an HTTP Proxy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/NET-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14270232#comment-14270232 ] Sebb commented on NET-552: -------------------------- Thanks, that's much easier to follow. I think there was still a minor issue - the patch removed the method {{FTPClient#_connectAction_()}}. This would mean any callers of the original method would not invoke the code now in the method {{FTPClient#_connectAction_(Reader)}}. I've restored the method. URL: http://svn.apache.org/r1650420 Log: NET-552 SocketTimeoutException connecting a FTP server via an HTTP Proxy Modified: commons/proper/net/trunk/src/changes/changes.xml commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTP.java commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java The code will be in snapshot builds from Jan 08 23:39 > SocketTimeoutException connecting a FTP server via an HTTP Proxy > ---------------------------------------------------------------- > > Key: NET-552 > URL: https://issues.apache.org/jira/browse/NET-552 > Project: Commons Net > Issue Type: Bug > Components: FTP > Affects Versions: 3.3 > Environment: All > Reporter: Quentin Devriendt > Labels: FTP, HTTP, Proxy, SocketTimeout > Fix For: 3.4 > > Attachments: ftp.patch > > > Randomly, we're experiencing SocketTimoutException when we connect an FTP via an Http Proxy : > {noformat} > java.io.IOException: Timed out waiting for initial connect reply > at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:403) > at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:931) > at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:925) > at org.apache.commons.net.ftp.FTPHTTPClient.connect(FTPHTTPClient.java:144) > Caused by: java.net.SocketTimeoutException: Read timed out > at java.net.SocketInputStream.socketRead0(Native Method) > at java.net.SocketInputStream.read(SocketInputStream.java:150) > at java.net.SocketInputStream.read(SocketInputStream.java:121) > at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) > at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) > at java.io.InputStreamReader.read(InputStreamReader.java:184) > at java.io.BufferedReader.fill(BufferedReader.java:161) > at java.io.BufferedReader.read(BufferedReader.java:182) > at org.apache.commons.net.io.CRLFLineReader.readLine(CRLFLineReader.java:58) > at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:315) > at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:295) > at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:397) > ... 6 more > {noformat} > After analysis, I think the problem is that commons-net opens 2 BufferedReader on the same InputStream : first in the FTPHTTPClient.tunnelHandshake method, and the second in FTP._connectAction() method. > If the first BufferedReader reads all datas in the socket, the second waits until SocketTimeout. -- This message was sent by Atlassian JIRA (v6.3.4#6332)