BUG: Vista network connectivity lost after opening many connectionswith Perl.exe

  • Thread starter Thread starter mikkon
  • Start date Start date
M

mikkon

BACKGROUND
----------

I first experienced a similar problem with the Internet Connection
Sharing as described here:
http://groups.google.fi/group/micro...5117a64677cc7/7bbc09109c097667?hl=en&ie=UTF-8

Microsoft issued a hotfix to fix that issue, and my web crawler worked
fine for some time. However, sometime late 2008, I started seeing the
same symptoms again. I think some update from Windows Update has
brought the problem back, but I have no idea which one. Anyway, the
test script still causes networking failures, but this time Internet
Connection Sharing doesn't seem to be part of it.

TO REPRODUCE
------------

To reproduce the problem, you can run the Perl script attached at the
end of this post (to run Perl scripts, please download the Perl
runtime from http://www.activestate.com/activeperl/ first). The script
is very simple, it reads the same page repeatedly. You can substitute
a real web page for http://127.0.0.1/test.htm. I used a test.htm file
that consisted of a linefeed only (2 bytes). Obviously, Vista IIS 7 is
serving the page from localhost.

The test script runs fine for about 9000 fetches after which all
network connectivity is lost. My computer can no longer connect to any
other computer. The problem applies to all software (and all users),
and none of them can open new connections. Existing connections work
fine.

After the problem appears, the only way to get rid of it is to reboot
my computer. Waiting with no activity doesn't help. I have tried
waiting several hours, once even close to 12 hours.

Before Vista SP2 "netstat -s" showed a large number of Current
Connections, and "netstat -n" a large number of ESTABLISHED
connections. After Vista SP2, however, current connections drop
quickly after running the test script, and open connections vanish,
but the problem still persists.

AFFECTED SYSTEMS
----------------

I have tested the script on the following systems, and the problem has
appeared on all of them:

- Windows Vista Business 32-bit with SP1
- Windows Vista Home 64-bit with SP1
- Windows Vista Ultimate 64-bit with SP1
- Windows Vista Ultimate 64-bit with SP2

The problem does not appear on Windows XP (tested with a 32-bit
version). I am currently running my web crawlers on virtual machines
with Windows XP. If I run them on my Vista computer, they corrupt the
network connectivity in less than 4 hours of runtime.

OTHER INFO
----------

The problem is probably related to the way Perl opens sockets. The
problem seems to happen with Perl only; if I create a similar test
script with MSXML, no problems occur. Also, if I specify the
keep_alive option to LWP::UserAgent->new, the problem doesn't occur so
quickly. I can run my crawlers for several days with this option, but
eventually the problem happens.

It seems that Perl opens sockets and does not close them properly. I
think the fact that those sockets affect network connectivity long
after the Perl.exe process has exited is a bug in Windows Vista.

If Perl were to fix this issue somehow, I still think there whould be
a bug left in Windows Vista. It would resurface with some other
software, including malicious ones that may want to do so on purpose.

Also note that the test script runs without administrative access, and
it causes a system-wide problem.

If anyone can reproduce the problem, please post here.
 
To reproduce the problem, you can run the Perl script attached at the
end of this post [...]

Sorry, forgot to attach the script. Here goes:

use strict;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();

my $n=1;
while (1) {
print "Fetching page $n...";

my $req = HTTP::Request->new(GET => "http://127.0.0.1/test.htm");
$req->header('Accept' => 'text/html');

# Send request.
my $res = $ua->request($req);

# Check the outcome.
if ($res->is_success) {
print " OK!\n";
$n++;
}
else {
print " ERROR: " . $res->status_line . ".\n";
sleep 1; # Don't flood the console.
}

$req=undef;
}
 
I'm running into a similar issue with Vista.
I have Apache 2.2, and CGI active perl scripts running to connect to a back-end Oracle XE instance running Bugzilla and I had no problems using Windows Server 2000, 2003 or XP, but Vista seems problematic.

I'll get the "500 Internal Server Error" at the client, which will go away on reload, however I didn't want this to be displayed so I wrote an shtml error to redirect the 500 error to and reload the page automatically.

The problem with this, though is that I can overload the system and then perl will hang up pegging the cpu at 98-100%.

The error showing up in a debug mode of Apache is pretty useless as it's the generic "Premature end of script headers" and the Windows event viewer is likewise useless as I get another hiccoughed generic message "Faulting application perl.exe, version 5.10.0.1005, time stamp 0x4a199d7b, faulting module ntdll.dll, version 6.0.6002.18005, time stamp 0x49e03821, exception code 0xc0000005, fault offset 0x000673d7, process id 0x6e8, application start time 0x01ca2d9477471f03."

I'm certain it's a socket issue, but I don't really know how to debug the whole thing from end-to-end to know where the hang-up is. All I really wanted to do was to port StarTeam to Bugzilla.

Any ideas on a fix for this, pls email me.

Tks!

Pat
 
Back
Top