I've got a script that has been throwing an intermittant error for the past month. Before that, it ran fine for over two years. The script connects to an ftp server and retrieves a bunch of binary files then processes them into our database. It runs once/hour and now it's failing about 50% of the time.

The error message is 'bad file number' and it's failing while attempting to connect to the remote server. The section of code where it fails is:

my $ftp = Net::FTP->new( $ftpHost, Debug => 0 ); if( ! $ftp ) { LogUtils::error( "Couldn't connect to '$ftpHost' ($@ : $!)" ); print( "Couldn't connect to '$ftpHost' ($@ : $!)\n" ); exit( -1 ); }

And the actual message that gets logged is "Couldn't connect to 'ftp.meteorlogix.com' ( : Bad file number)".

The system it runs on is Solaris. Oddly, the exact same script runs in our dev environment just fine (connects to the same remote server, once/hour). It has also run without errors every time that I've manually run it.

I've set Debug to 1 and captured the output:

Net::FTP: Net::FTP(2.65) Net::FTP: Exporter(5.562) Net::FTP: Net::Cmd(2.21) Net::FTP: IO::Socket::INET(1.25) Net::FTP: IO::Socket(1.26) Net::FTP: IO::Handle(1.21) Net::FTP: Unexpected EOF on command channel at /local/rtp/rtp-0.4/bin/ +meteorlogix line 215

That output doesn't change when I add the Passive => 1 to the constructor options either.

Any ideas??

Dave


In reply to ftp connection problem by DaveKub

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.