Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

ActivePerl socket crashes on Checked Build Windows

by raandom (Acolyte)
on Jun 09, 2013 at 11:53 UTC ( #1037923=perlquestion: print w/replies, xml ) Need Help??
raandom has asked for the wisdom of the Perl Monks concerning the following question:

This simple code crashes ActiveState Perl on Checked Build Windows 2008r2/2012:

use strict; use IO::Socket; my $peeraddr = 'some_host'; my $sock = new IO::Socket::INET ( PeerAddr => $peeraddr, PeerPort => '8282', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; # crashes here: $sock->close();
Error and stack trace:
(4ec.674): Invalid handle - code c0000008 (!!! second chance !!!) ntdll!KiRaiseUserExceptionDispatcher+0x4a: 000007f8`140dde8a 8b8424c0000000 mov eax,dword ptr [rsp+0C0h] ss: +00000000`0013f6b0=c0000008 ntdll!KiRaiseUserExceptionDispatcher+0x4a KERNELBASE!CloseHandle+0x38 msvcrt!close_nolock+0x62 msvcrt!close+0xdb perl514!PerlIO_findFILE+0xedd perl514!PerlIO_importFILE+0x1b9 perl514!PerlIOBuf_close+0x89 perl514!Perl_PerlIO_close+0x40 perl514!Perl_runops_debug+0x945 perl514!Perl_setdefout+0xcb0 perl514!Perl_runops_standard+0x16 perl514!Perl_get_av+0x115f perl514!perl_run+0x246 perl514!RunPerl+0x161 perl+0x1351 KERNEL32!BaseThreadInitThunk+0x1d ntdll!RtlUserThreadStart+0x38
It is funny that the only AS Perl version which works fine is 5.8.9. Others - some 5.10, some 5.12 and latest 5.14 and 5.16 - crash. I could not find anything related in the internet. Is this known feature?
UPD: I have checked Strawberry Perl - no problem.
UPD: Application Verifier on plain Windows diagnose the same problem in AS Perl 5.1x.

Replies are listed 'Best First'.
Re: ActivePerl socket crashes on Checked Build Windows
by kcott (Chancellor) on Jun 09, 2013 at 18:24 UTC

    G'day raandom,

    I see you've used indirect object syntax:

    my $sock = new IO::Socket::INET ( ... );

    Here's what perlobj - Invoking Class Methods has to say about that:

    Indirect Object Syntax

    Outside of the file handle case, use of this syntax is discouraged, as it can confuse the Perl interpreter. See below for more details.


    Do you encounter the same problems with:

    my $sock = IO::Socket::INET::->new( ... );

    [I don't have any of the versions you mention, so I'm unable to test this.]

    -- Ken

      Thanks for advise: I will repair confusing syntax in my code. But it won't help. Even this code crashes:
      use strict; use Socket; socket(my $socket, PF_INET, SOCK_STREAM, 0) or die "socket: $!"; # crashes here: close($socket);
      I wrote to ActiveState support. Will see what they say.
        I couldn't reproduce any problem with that code and any of my ActivePerl installations.
        I tried both 32-bit and 64-bit versions of build 1600 (perl-5.16.0), build 1200 (perl-5.12.0) and build 1005 (perl-5.10.0).
        And that (second lot of) code you provided ran silently and successfully.

        What do you get when you run:
        perl -MSocket -e "print $Socket::VERSION;"
Re: ActivePerl socket crashes on Checked Build Windows
by bulk88 (Priest) on Jun 11, 2013 at 18:04 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1037923]
Approved by Corion
What's the matter? Cat got your tongue?...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2018-01-23 18:26 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (252 votes). Check out past polls.