You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John DeBenedette <Jo...@inttra.com> on 2004/01/12 04:39:44 UTC

mod_perl 1.99_13 - IO:Socket::INET works only once - other side d efunct thereafter

SERVER_SOFTWARE = "Apache/2.0.48 (Win32) mod_perl/1.99_13-dev Perl/v5.8.2
PHP/4.3.4 mod_ssl/2.0.48 OpenSSL/0.9.7c" 

The following works flawlessly under CGI but when attempting under Registry
as module or PerlRun as script, it works once perfectly, then continues to
work with no discernable error but causes the listening server's accept()
process to go <defunct> and therefore $resp comes back empty and application
fails on its face.  was last tried un-handlerized under PerlRun to make
isolation simpler but works there too, just kills (kind of) his socket-mate
and goes on his merry way like everything is cool.  restart apache and you
get another go at it - but just 1.
------------------------------------------------------------------
my ($poolport, $host, $conpool, $cmd, $session_data, $resp);
$poolport = "7867";
$host = "192.168.0.3";
$session_data = "yada yada";
$cmd = "watch seinfeld";
$conpool = IO::Socket::INET->new(PeerAddr => $dbhost, PeerPort =>
$dbpoolport, Proto => "tcp", Type => SOCK_STREAM) > or die "could not
connect to $host on $poolport : $@\n"; 
print $conpool $session_data;
print $conpool $cmd;
print $resp = <$conpool>;
close($conpool);
exit; 
-----------------------------------------------------------------
Above is talking to a guy (on AIX 4.3.3.10 straight perl 5.6.0 with no web
server, just a forked server listening) - this exact same server and code
below listens/works with above when above uses CGI.  The perl code from the
other box is shown below:
-----------------------------------------------------------------
use IO::Socket;
$server_port = 7867;
$server = IO::Socket::INET->new(LocalPort => $server_port, > Type =>
SOCK_STREAM, > Proto => "tcp", > Reuse => 1, > Listen => 10) > or die
"Nothing doing on port $server_port : $@\n";
  while (1) { 
    $client = $server->accept();# or last; # craps out from mod_perl with or
without - he goes defunct an un-natural way without telling a soul
    $session_data = <$client>; 
    $dbcmd = <$client>;
    print $client $dbsession->cmd($dbcmd);
 }
close($server); 
$dbsession->close;
exit; 

Thanks in advance!
John








----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------
This e-mail and any attachments thereto are intended only for use by the
addressee(s) named herein and may contain proprietary and/or confidential
information. If you are not the intended recipient of this e-mail, you are
hereby notified that any dissemination, distribution or copying of this
e-mail, and any attachments thereto, is strictly prohibited. If you have
received this e-mail in error, please immediately notify
Postmaster@INTTRA.com and permanently delete the original, any attachments,
any copies thereof, and any printouts thereof.

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: mod_perl 1.99_13 - IO:Socket::INET works only once - other side d efunct thereafter

Posted by Perrin Harkins <pe...@elem.com>.
On Sun, 2004-01-11 at 22:39, John DeBenedette wrote:
> The following works flawlessly under CGI but when attempting under Registry
> as module or PerlRun as script, it works once perfectly, then continues to
> work with no discernable error but causes the listening server's accept()
> process to go <defunct> and therefore $resp comes back empty and application
> fails on its face.

Many people have reported having this sort of problem with IO::Socket on
Windows.  It doesn't seem to be directly related to mod_perl, but you
usually don't notice it in CGI because you don't try to connect more
than once in a CGI script.  It's possible that the problem is caused by
an IO::Socket bug.  If you look in the mail archives you may find some
ideas for workarounds, or you could try a general Perl/Windows mailing
list or e-mail the module maintainer.

It's also possible that I'm mis-diagnosing it and yours is different
from the other errors, so check the mail archive first.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html