commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Bouteille <cy...@peerflix.com>
Subject Re: [NET] listFiles throws SocketException: Connection reset even in passive mode
Date Wed, 10 Jan 2007 01:02:55 GMT
Hi Rory,
Yes, I used net 2.0 you gave me a link for last time with the 
examples.PrintCommandListener from 1.4.1 release + it's running on java 
1.5.0_11.
Let me know you would suggest to proceed in debugging what's happening.
Thank you,

Rory Winston wrote:
> Hi Cyril
>
> Thanks for this - is this with commons-net version 1.4 or the 2.0 
> prerelease? If it is 1.4, can you try it with the 2.0 prerelease and 
> see if the error still occurs?
>
> The prerelease is here:
>
> http://people.apache.org/~rwinston/commons-net-2.0/commons-net-ftp-2.0.0-SNAPSHOT.jar

>
>
> You will need Java 5 or later.
>
> Thanks
> Rory
>
> Cyril Bouteille wrote:
>> Hi Rory,
>> Please find below the output of the listener. Let me know what you 
>> think!
>>
>> 220 envmgr2 Microsoft FTP Service (Version 5.0).
>> USER FTP_USPS_CONFIRM
>> 331 Password required for FTP_USPS_CONFIRM.
>> PASS ***
>> 230-Welcome to Envelope Manager FTP
>> 230 User FTP_USPS_CONFIRM logged in.
>> INFO 10:53:44 MailScanJob.runJob: Connected to ftp.envmgr.com as 
>> FTP_USPS_CONFIRM -- 230-Welcome to Envelope Manager FTP
>> 230 User FTP_USPS_CONFIRM logged in.
>> CWD /confirm
>> 250 CWD command successful.
>> PWD
>> 257 "/confirm" is current directory.
>> INFO 10:53:44 MailScanJob.runJob: MailScan Folder: /confirm
>> TYPE A
>> 200 Type set to A.
>> INFO 10:53:46 MailScanJob.processMailScans: Retrieving list of files 
>> in directory...
>> SYST
>> 215 Windows_NT version 5.0
>> PASV
>> 227 Entering Passive Mode (65,203,54,10,5,104).
>> LIST
>> 125 Data connection already open; Transfer starting.
>>
>> hangs there for a while... and then blows up with SocketException: 
>> connection reset.
>>
>> Rory Winston wrote:
>>> Hi Cyril
>>>
>>> Can you try again with 2.0, but this time can you attach a 
>>> PrintCommandListener to the FTPClient instance? You can see how to 
>>> do this here:
>>>
>>> FTPClient client = new FTPClient();
>>> client.addProtocolCommandListener(new PrintCommandListener(new 
>>> PrintWriter(System.out)));
>>>
>>>
>>> This will log all FTP traffic to stdout. When you have done this, 
>>> can you send the relevant output?
>>>
>>> A more comprehensive way to try and locate the problem is to 
>>> download the source distribution as well:
>>>
>>> http://people.apache.org/~rwinston/commons-net-2.0/commons-net-2.0.0-SNAPSHOT-src.zip

>>>
>>>
>>> And then run your test program from within your IDE, after attaching 
>>> a breakpoint at the relevant location.
>>> Is the FTP server in question publicly accessible?
>>>
>>> Thanks
>>> Rory
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Cyril Bouteille wrote:
>>>> Hi Rory,
>>>> I just tried your 2.0 snapshot and I'm getting the exact same issue 
>>>> (see log below).
>>>> I'm assuming I'm using the new jar correctly as the line #s in the 
>>>> stack trace have changed, but please let me know if it's not the case.
>>>> Any other idea? Is there any way to turn on debug logging for this 
>>>> lib?
>>>> Thank you,
>>>>
>>>> INFO 08:58:06 MailScanJob.runJob: Connected to ftp.envmgr.com as 
>>>> xxx --
>>>> 220 envmgr2 Microsoft FTP Service (Version 5.0).
>>>> 331 Password required for xxx
>>>> 230-Welcome to Envelope Manager FTP
>>>> 230 User xxx logged in.
>>>> INFO 08:58:06 MailScanJob.runJob: MailScan Folder: /confirm
>>>> INFO 08:58:08 MailScanJob.processMailScans: Retrieving list of 
>>>> files in directory...
>>>> SEVERE 09:01:20 MailScanJob.runJob: MailScanJob.runJob: Exception 
>>>> java.net.SocketException: Connection reset
>>>> java.net.SocketException: Connection reset
>>>>        at java.net.SocketInputStream.read(SocketInputStream.java:168)
>>>>        at 
>>>> sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
>>>>        at 
>>>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
>>>>        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
>>>>        at java.io.InputStreamReader.read(InputStreamReader.java:167)
>>>>        at java.io.BufferedReader.fill(BufferedReader.java:136)
>>>>        at java.io.BufferedReader.readLine(BufferedReader.java:299)
>>>>        at java.io.BufferedReader.readLine(BufferedReader.java:362)
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPFileEntryParserImpl.readNextEntry(FTPFileEntryParserImpl.java:53)

>>>>
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPListParseEngine.readStream(FTPListParseEngine.java:152)

>>>>
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPListParseEngine.readServerList(FTPListParseEngine.java:100)

>>>>
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2314)

>>>>
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2281)

>>>>
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2058)
>>>>        at 
>>>> org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2105)
>>>>        at 
>>>> peerflix.job.trade.MailScanJob.processMailScans(MailScanJob.java:136)
>>>>        at peerflix.job.trade.MailScanJob.runJob(MailScanJob.java:87)
>>>>        at peerflix.job.PfxJob.main(PfxJob.java:97)
>>>>
>>>>
>>>> Rory Winston wrote:
>>>>> Hi Cyril
>>>>>
>>>>> If you are running Java 1.5 or later, you can try the latest 
>>>>> snapshot of commons-net 2.0 and see if that fixes the issue:
>>>>>
>>>>> http://people.apache.org/~rwinston/commons-net-2.0/commons-net-2.0.0-SNAPSHOT.jar

>>>>>
>>>>>
>>>>> Rory
>>>>>
>>>>> Cyril Bouteille wrote:
>>>>>> Thanks for your reply Mark.
>>>>>> This exception occurs on a simple 'ls' (listFiles()) in a 
>>>>>> directory with less than 100 files. This command returns within a

>>>>>> couple seconds @ ftp cli. But the commons.net program can hang 
>>>>>> for hours and then exit with this "connection reset" exception.
>>>>>> We do use the same FTP server in dev and prod. It's one from the

>>>>>> USPS. Only the client network and machine the commons.net program

>>>>>> runs on is different.
>>>>>> It feels like a network connectivity issue, but I don't 
>>>>>> understand how the ftp cli and commons.net library behave 
>>>>>> differently in a way explaining this...
>>>>>> Any idea?
>>>>>>
>>>>>> Mark Fortner wrote:
>>>>>>> Sounds like your production environment has different FTP socket

>>>>>>> timeout settings.  Does this exception occur with a large file

>>>>>>> in your production environment?  If so, is that same file 
>>>>>>> available in your dev environment?
>>>>>>>
>>>>>>> You may want to compare the settings on FTP servers and make

>>>>>>> sure they're the same.
>>>>>>>
>>>>>>> Hope this helps,
>>>>>>>
>>>>>>> Mark
>>>>>>>
>>>>>>> PS Don't forget to prefix the subject lines of your email with

>>>>>>> "[VFS]" as this list is shared by a lot of different groups.
>>>>>>>
>>>>>>> On Friday, December 29, 2006, at 07:57 PM, Cyril Bouteille wrote:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>> I've a Java 1.5 program retrieving files over ftp using net

>>>>>>>> 1.4.1, which works fine in our dev environment, but throws
the 
>>>>>>>> exception below in our production environment on the 
>>>>>>>> listFiles() call.
>>>>>>>> 1) I am calling enterLocalPassiveMode() to use passive mode,
and
>>>>>>>> 2) I'm able to list files with the ftp cli client on the
same 
>>>>>>>> production machine that the Java program is running on, so

>>>>>>>> network ACLs seem ok
>>>>>>>> Is there anything else I am missing?
>>>>>>>> I'm at loss on how to resolve this issue and would appreciate

>>>>>>>> your input.
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> SEVERE 16:13:14 MailScanJob.runJob: Exception 
>>>>>>>> java.net.SocketException: Connection reset
>>>>>>>> java.net.SocketException: Connection reset
>>>>>>>>     at java.net.SocketInputStream.read(SocketInputStream.java:168)
>>>>>>>>     at 
>>>>>>>> sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)

>>>>>>>>
>>>>>>>>     at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
>>>>>>>>     at java.io.InputStreamReader.read(InputStreamReader.java:167)
>>>>>>>>     at java.io.BufferedReader.fill(BufferedReader.java:136)
>>>>>>>>     at java.io.BufferedReader.readLine(BufferedReader.java:299)
>>>>>>>>     at java.io.BufferedReader.readLine(BufferedReader.java:362)
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPFileEntryParserImpl.readNextEntry(FTPFileEntryParserImpl.java:95)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPListParseEngine.readStream(FTPListParseEngine.java:150)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPListParseEngine.readServerList(FTPListParseEngine.java:98)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2396)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2364)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2141)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2188)

>>>>>>>>
>>>>>>>>     at 
>>>>>>>> peerflix.job.trade.MailScanJob.processMailScans(MailScanJob.java:136)

>>>>>>>>
>>>>>>>>     at peerflix.job.trade.MailScanJob.runJob(MailScanJob.java:87)
>>>>>>>>     at peerflix.job.PfxJob.main(PfxJob.java:97)
>>>>>>>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message