Note that there are some explanatory texts on larger screens.

plurals
  1. POLWP connect issues despite fresh install
    text
    copied!<h1>Update</h1> <p>Working on a theory, I edited <code>LWP/Protocol/http.pm</code> to include a sleep statement in the subroutine <code>request</code>:</p> <pre><code>if (!$has_content || $write_wait || $has_content &gt; 8*1024) { WRITE: { # Since this just writes out the header block it should almost # always succeed to send the whole buffer in a single write call. my $n = $socket-&gt;syswrite($req_buf, length($req_buf)); sleep 2; ## &lt;----- NEW unless (defined $n) { ... </code></pre> <p>And the <code>get</code> statement worked, returning a <code>200 OK</code>. Much thanks for <a href="https://stackoverflow.com/users/1493754/alan-curry">Alan Curry</a> for help with debugging and finding this particular place in the code.</p> <p>Not sure it completely answers the question, or if the solution works long term. Will have to do some more checking.</p> <h1>Summary:</h1> <ul> <li><a href="http://search.cpan.org/perldoc?LWP::UserAgent" rel="nofollow noreferrer">LWP::UserAgent</a> module using the <code>get</code> subroutine fails for some URLs, reporting 500 timeout. </li> <li>Only <strong><em>some</em></strong> URLs fail. E.g. <code>www.google.com</code> fails, but <code>www.google.se</code> succeeds.</li> <li>I have no other connection issues, all URLs are reachable with browser and through cmd programs such as ping.</li> <li>Because of this problem, I cannot install modules for perl with CPAN or ActivePerl's ppm.</li> <li>The problem persisted after installing another perl distribution.</li> <li>Weirdly enough, using the debugger and stepping through the code makes the failing URLs succeed.</li> <li>I am using a firewall, and perl is allowed to make connections. (Not relevant, since some URLs succeed)</li> <li>Firewall log shows perl being allowed to connect for both failing URLs and non-failing. (See below) The log also shows sockets opening to listen, but timestamps are mismatched for failing connections.</li> </ul> <h1>Goal</h1> <ul> <li>I'm primarily looking for any solution to be able to install modules.</li> <li>I'm interested in all suggestions on how to debug the problem, complete solutions <em>not required</em>. Any hints or tips are welcome.</li> </ul> <h1>Elaboration</h1> <p>I have been using ActivePerl v5.14 for some time. Installing modules with their Perl Package Manager <code>ppm</code> command and gui worked very well, but at some point stopped working, reporting a 500 timeout. The cpan shell reported the very same thing.</p> <p>I have googled this problem extensively, but found nothing that relates to my problem, or helps in any way.</p> <p>ActivePerl support claims it may be a proxy setting, which is ludicrous. I have lots of programs that connect to the internet that do not need proxy settings, and as far as I know, I do not need to do this. I have tried to find out what my proxy settings are, if any, but the only thing I have found is vague references such as "use the system settings", "no proxy required" and "proxy is the same as your IP".</p> <p>So last night I had enough and installed strawberry perl instead, but it suffers from the same problem. I uninstalled ActivePerl afterwards.</p> <p>Anyway, I have experimented with LWP modules and found that I can reproduce the errors there. It seems it is limited to certain websites, and cpan is one of them (?). I created this script for testing:</p> <pre><code>use strict; use warnings; use LWP::UserAgent; use URI; my $ua = LWP::UserAgent-&gt;new; my $url = shift; my $u = URI-&gt;new($url); $ua-&gt;no_proxy('cpan.strawberryperl.com','cpan.com',$u-&gt;host); $ua-&gt;timeout(30); my $r = $ua-&gt;get($url); if ($r-&gt;is_success) { print $r-&gt;decoded_content; } else { die $r-&gt;status_line; } </code></pre> <p>And then did some testing:</p> <pre><code>tx.pl http://cpan.strawberryperl.com/authors/01mailrc.txt.gz 500 read timeout at tx.pl line 23. tx.pl http://stackoverflow.com 500 read timeout at tx.pl line 23. tx.pl http://www.google.se &lt;!doctype html&gt;&lt;html itemscope itemtype="http://schema.org/WebPage"&gt;&lt;head&gt;&lt;meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"&gt;&lt;meta ... </code></pre> <p>So, google works, and www.youtube.com also works, but www.yahoo.com and search.cpan.com fails. The default timeout of 180 seconds makes this an incredibly annoying thing to debug, which is why I reduced it in my script. Needless to say, all of these URLs are reachable if I try to reach them with Firefox or ping.</p> <hr> <p><strong>ETA:</strong></p> <p>Strangely enough, running the script through the debugger, turning on trace and skipping to the end makes the previously failed connections successful. </p> <p>It would seem to imply that there is some kind of hiccup, missed timing that is "fixed" when the script runs more slowly due to printing thousands of lines of trace code.</p> <hr> <p>I could understand this issue as being a result of some ActivePerl module getting corrupted, but strawberry perl is using a completely different set of files, so it must be my system. </p> <p>Why some sites work and some don't is baffling. I could understand that some sites like stackoverflow.com would protect themselves against potential bots, but why cpan would thwart its own package manager makes no sense.</p> <p>I am using a firewall, and Perl has been allowed to make connections. My system is a rather old installation of Windows XP (~5 years). While running dual boot with Ubuntu I've never encountered this problem, which is another clue that it is not something to do with proxies. </p> <p>I am well and truly stumped. If anyone could help me debug this, I would be very grateful.</p> <p>The CPAN shell error messages below. The funny thing is, it says it tries to use the ftp as a last resort, but I just discovered that the ftp command has not been allowed by my firewall, and if it was used, it should have asked me for permission. </p> <pre><code>Fetching with LWP: http://cpan.strawberryperl.com/authors/01mailrc.txt.gz LWP failed with code[500] message[read timeout] Warning: no success downloading 'D:\strawberry\cpan\sources\authors\01mailrc.txt .gz.tmp1252'. Giving up on it. Fetching with LWP: http://www.cpan.org/authors/01mailrc.txt.gz LWP failed with code[500] message[read timeout] Warning: no success downloading 'D:\strawberry\cpan\sources\authors\01mailrc.txt .gz.tmp1252'. Giving up on it. Warning: no success downloading 'D:\strawberry\cpan\sources\authors\01mailrc.txt .gz.tmp1252'. Giving up on it. As a last resort we now switch to the external ftp command 'C:\WINDOWS\system32\ ftp.EXE' to get 'D:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp1252'. Doing so often leads to problems that are hard to diagnose. If you're the victim of such problems, please consider unsetting the ftp config variable with o conf ftp "" o conf commit Please check, if the URLs I found in your configuration file (http://cpan.strawberryperl.com/, http://www.cpan.org/) are valid. The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/' Could not fetch authors/01mailrc.txt.gz </code></pre> <p>Firewall log for trying to fetch non-failing URL (www.google.se) and failing (stackoverflow.com):</p> <pre><code>2012-06-27T18:34:04+01:00,info,appl control,C:\WINDOWS\system32\svchost.exe,allow,listen,17,0.0.0.0,56564 2012-06-27T18:34:04+01:00,info,appl control,C:\WINDOWS\system32\svchost.exe,allow,send,17,195.54.122.198,53 2012-06-27T18:34:13+01:00,info,appl control,D:\strawberry\perl\bin\perl.exe,allow,connect out,6,64.34.119.12,80 2012-06-27T18:34:13+01:00,info,appl control,D:\strawberry\perl\bin\perl.exe,allow,connect out,6,64.34.119.12,80 2012-06-27T18:34:21+01:00,info,appl control,C:\Program\Mozilla Firefox\firefox.exe,allow,connect out,6,74.86.70.106,80 2012-06-27T18:34:28+01:00,info,appl control,C:\Program\Mozilla Firefox\firefox.exe,allow,connect out,6,64.34.119.12,80 2012-06-27T18:34:30+01:00,info,appl control,C:\WINDOWS\system32\svchost.exe,allow,listen,17,0.0.0.0,56664 2012-06-27T18:34:30+01:00,info,appl control,C:\WINDOWS\system32\svchost.exe,allow,send,17,195.54.122.198,53 2012-06-27T18:34:30+01:00,info,appl control,D:\strawberry\perl\bin\perl.exe,allow,connect out,6,74.125.143.94,80 2012-06-27T18:34:30+01:00,info,appl control,D:\strawberry\perl\bin\perl.exe,allow,connect out,6,74.125.143.94,80 2012-06-27T18:35:14+01:00,info,appl control,C:\Program\Mozilla Firefox\firefox.exe,allow,connect out,6,64.34.119.12,80 2012-06-27T18:35:21+01:00,info,appl control,C:\Program\Mozilla Firefox\firefox.exe,allow,connect out,6,74.86.70.106,80 2012-06-27T18:36:21+01:00,info,appl control,C:\Program\Mozilla Firefox\firefox.exe,allow,connect out,6,74.86.70.106,80 2012-06-27T18:37:04+01:00,info,appl control,C:\WINDOWS\system32\svchost.exe,allow,listen,17,0.0.0.0,61215 2012-06-27T18:37:04+01:00,info,appl control,C:\WINDOWS\system32\svchost.exe,allow,send,17,195.54.122.198,53 2012-06-27T18:37:07+01:00,info,appl control,D:\strawberry\perl\bin\perl.exe,allow,connect out,6,64.34.119.12,80 2012-06-27T18:37:07+01:00,info,appl control,D:\strawberry\perl\bin\perl.exe,allow,connect out,6,64.34.119.12,80 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload