The following code works correctly IN the debugger, but fails with "Bad file descriptor" when not in the debugger. If I am using a regular IO::Socket::INET object, it works just fine both in and out of the debugger.
$fd = $s->fileno(); vec($rin, $fd, 1) = 1; vec($win, $fd, 1) = 1; $ein = $rin | $win; my $i; while (($nf, $tl) = select(undef, $wout=$win, $eout=$ein, 2)) { $i++; $ti = Time::HiRes::time() - $t0; print STDERR "write select loop count $i $ti\n"; if ($ti >= $f{'-timeout'}) { print STDERR "Timed out writing ($ti) $!\n"; return (-20, {}, "write_timeout", $ti); } if (vec($eout, $fd, 1) == 1) { print STDERR "Got an error while writing $! $@\n"; return (-20, {}, "write_error", $ti); } if (vec($wout, $fd, 1) == 1) { $b = syswrite($s, $msg, $l - $b, $b); $t = $t + $b; last if $t = $l; } }
Am I retarded or is this incredibly weird? The following is what I get from using strace
select(8, NULL, [3 4 5], [3 4 5], {2, 0}) = -1 EBADF (Bad file descrip +tor)
FYI, this is perl5.8 (with ithreads) on both redhat and mandrake I tried with the most recent Net::SSLeay and IO::Socket::SSL from CPAN.

I have verified that the SSL socket is made in both cases (in and out of the debugger) by looking at the output of strace and using the debugging functionality if IO::Socket::SSL.

Thanks for any help

RR

In reply to IO::Socket::SSL, perl5.8, or select bug? by rr

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.