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:53:17 UTC

RE: mod_perl 1.99_13 - IO:Socket::INET works only once - other si de d efunct thereafter

correction of typo in my example at INET->new
$dbpoolport s/b $poolport
$dbhost s/b $host

-----Original Message-----
From: John DeBenedette [mailto:John.DeBenedette@inttra.com]
Sent: Sunday, January 11, 2004 10:40 PM
To: 'modperl@perl.apache.org'
Subject: 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 => $host, PeerPort =>
$poolport, 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








----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------
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 si de d efunct thereafter

Posted by Stas Bekman <st...@stason.org>.
John DeBenedette wrote:
> correction of typo in my example at INET->new
> $dbpoolport s/b $poolport
> $dbhost s/b $host

What would it take to paste the real minimal script that fails? It's full of 
problems. You have '>' in:

   $poolport, Proto => "tcp", Type => SOCK_STREAM) > or die "could not

you don't load IO::Socket, you don't import SOCK_STREAM. It doesn't look 
right. Thanks.

what happens if instead of 'print $conpool' you use '$conpool->send()'? and 
instead of <$conpool> - $conpool->recv(), per IO::Socket manpage.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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