You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Quentin Devriendt (JIRA)" <ji...@apache.org> on 2014/08/25 17:07:58 UTC

[jira] [Comment Edited] (NET-552) SocketTimeoutException connecting a FTP server via an HTTP Proxy

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

Quentin Devriendt edited comment on NET-552 at 8/25/14 3:06 PM:
----------------------------------------------------------------

I have written a patch that fixing this bug :
I pass the first java.io.Reader (created in tunnelHandshake method of FTPHTTPClient class) to the method that affects the instance variable Reader \_controlInput\_ to keep datas that has already been read.


was (Author: qdevriendt):
I have written a patch that fixing this bug :
I pass the first java.io.Reader (created in tunnelHandshake method of FTPHTTPClient class) to the method that affects the instance variable Reader _controlInput_ to keep datas that has already been read.

> 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
>         Attachments: FtpOverHttpProxy.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.2#6252)