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 5.16.3.1 - no problem.
UPD: Application Verifier on plain Windows diagnose the same problem in AS Perl 5.1x.

In reply to ActivePerl socket crashes on Checked Build Windows by raandom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.