Wiggins has asked for the wisdom of the Perl Monks concerning the following question:

Since starting with Perl 5.10 on my current system, I have been using CPANplus (CPp (abbreviation overload)) to manage files (I use what's here).
And since the beginning I have had a constant problem with a 5 minute pause within almost each command. I would expect that others here might have had this same problem. The explanation of the cause is below.

I believe the 5 minutes is an internal CPp/dependancy timeout for an incomplete FTP connection. Where should I look to modify this value to a more reasonable number?


CPp starts with a DNS for ftp.cpan.org which returns 3 entries (partial display):

[Time: 0.001157000 seconds] Transaction ID: 0x2b66 Flags: 0x8180 (Standard query response, No error) Questions: 1 Answer RRs: 3 Authority RRs: 0 Additional RRs: 0 Queries ftp.cpan.org: type A, class IN Answers ftp.cpan.org: type CNAME, class IN, cname ftp.cpan.ddns.develo +oper.com ftp.cpan.ddns.develooper.com: type A, class IN, addr 149.20.20 +.135 ftp.cpan.ddns.develooper.com: type A, class IN, addr 64.74.207 +.33
The IP 149.20.20.135 is actually mirror1.kernel.org and is the site of interest. This mislabeling(?) is used later in the capture display below.
When CPp accesses that site (149.20.20.135 aka mirror1.kernel.org), the last part of the trace looks like this:
No. Time Source Destination Protoc +ol Info 478 8.439037 ftp.cpan.ddns.develooper.com 192.168.42.133 + FTP Response: 230-\t\t\t mirrors.kernel.org 479 8.478342 192.168.42.133 ftp.cpan.ddns.develooper.com + TCP 35108 > ftp [ACK] Seq=44 Ack=181 Win=5840 Len=0 480 125.530181 ftp.cpan.ddns.develooper.com 192.168.42.133 + TCP ftp > 38778 [RST] Seq=585 Win=64239 Len=0 481 127.866995 ftp.cpan.ddns.develooper.com 192.168.42.133 + TCP ftp > 38780 [RST] Seq=587 Win=64239 Len=0 489 308.440613 ftp.cpan.ddns.develooper.com 192.168.42.133 + TCP ftp > 35108 [ACK] Seq=181 Ack=45 Win=64239 Len=0 490 308.517008 192.168.42.133 192.168.42.2 DNS + Standard query A ftp.cpan.org 491 308.518349 192.168.42.2 192.168.42.133 DNS + Standard query responseCNAME ftp.cpan.ddns.develooper.com A 64.74. +207.33 A 149.20.20.135
I removed packet 482-488 since they are arps and such. Note the time(seconds) of packets 479,480,and 489. Blimey.. 5 minutes have elapsed!! At packet 490, the process continues after the timeout. Using wireshark's 'follow' capability, the exchange looks like:
220 Welcome to mirrors.kernel.org. USER anonymous 331 Please specify the password. PASS cpanplus@example.com 230-..Welcome to the mirror archives of the 230-...LINUX KERNEL ARCHIVES 230-... mirrors.kernel.org 230-
CPp is still waiting for the end of the multi-line reply started with the "230-\n"
After looking at section 4.2 (multi-line replies) of RFP 959, I see that the kernel.org response is not RFC compliant for multi-line replys. The last 230 must be followed by a <SP>space "230 \n".

It is always better to have seen your target for yourself, rather than depend upon someone else's description.

Replies are listed 'Best First'.
Re: CPANplus 5 minute timeout
by bingos (Vicar) on Jan 15, 2009 at 20:38 UTC

    5 minutes sounds like a default.

    CPANPLUS uses File::Fetch, a bit of digging around has found that the following CPANPLUS configuration settings apply:

    # Use passive mode for FTP connections CPAN Terminal> s conf passive 1 # Set network timeout (counted in seconds). CPAN Terminal> s conf timeout 300

    That said, you may be better off selecting a different mirror, maybe one closer to yourself:

    CPAN Terminal> s reconfigure =================> MAIN MENU <================= Welcome to the CPANPLUS configuration. Please select which parts you wish to configure Defaults are taken from your current configuration. If you would save now, your settings would be written to: CPANPLUS::Config::User 1> Select Configuration file 2> Setup CLI Programs 3> Setup CPANPLUS Home directory 4> Setup FTP/Email settings 5> Setup basic preferences 6> Setup installer settings 7> Select mirrors 8> Edit configuration file 9> Save & exit 10> Quit without saving Section to configure: [1]: 7
      Thank you for the pointer to the CPp options.

      If you look at packets 490 and 491, you will see that the IP for mirror1.kernel.org comes from CPAN's DNS server, not from any user configuration. They seem to have some dynamic mechanism to supply multiple values. Today 2 other IPs appear in answer to:

      [Sherlock]> host ftp.cpan.org ftp.cpan.org is an alias for ftp.cpan.ddns.develooper.com. ftp.cpan.ddns.develooper.com has address 69.31.115.210 ftp.cpan.ddns.develooper.com has address 207.57.106.5
      It is always better to have seen your target for yourself, rather than depend upon someone else's description.