Hi,
My longtime working project, with sockets in threads, became unstable. After unistalling Activestate Perl 5.8.0 and FRESH installing v5.8.2 b808 (Windows msi installer) built for MSWin32-x86-multi-thread.
I get many Perl errors such as "Attempt to free unreferenced scalar: SV 0x280bac00 at D:/Perl/lib/IO/Socket.pm line 46." and similar others.
Also, Perl.exe crashs! easily :(
This simple code will produce the error and/or crash Perl.exe. Using Activestate Perl 5.8.2 on Windows 2000 Server SP2. It worked just fine for me on v5.8.0.
You may need to retry few times to get the error or the crash.
Please advise :)
==============================
#!/usr/bin/perl
use 5.008; # 5.8 required for "stable" threading
use strict;
use warnings;
use threads;
use threads::shared;
use IO::SOCKET;
for (my $i = 0; $i < 5; $i++) {
threads->create(\&start_thread, "www.yahoo.com:80")->detach;
# threads->create(\&start_thread, "www.yahoo.com:80")->join; #wor
+ks, but who cares :)
}
sleep(5);
print STDERR "done\n";
exit;
sub start_thread {
my $hostport = shift;
my $tid = threads->self->tid;
print STDERR "Connecting $tid\n";
my $socket = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $hostport);
$socket or die "[$!]\n";
$socket->autoflush(1);
close($socket);
print STDERR "Closing $tid\n";
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.