Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

IO::Socket::SSL, perl5.8, or select bug?

by rr (Sexton)
on Apr 21, 2003 at 18:46 UTC ( #252087=perlquestion: print w/replies, xml ) Need Help??

rr has asked for the wisdom of the Perl Monks concerning the following question:

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


Replies are listed 'Best First'.
Re: IO::Socket::SSL, perl5.8, or select bug?
by rr (Sexton) on Apr 21, 2003 at 19:22 UTC

    IO::Socket::INET fails too, it does work under mod_perl tho.

    Sorry for the confusion.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://252087]
Approved by Thelonius
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2022-07-07 07:05 GMT
Find Nodes?
    Voting Booth?

    No recent polls found