perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject re-post : duplicate sockets with mp2, apache2, linux
Date Thu, 20 Sep 2007 11:17:15 GMT
This is a repost of "duplicate sockets ? mod-perl 2.0.2, apache 2.2", 
because I still don't understand what's happening and can still not find 
the problem.
I would be very grateful if anyone could help me, because I'm out of my 
wits.

More information is currently accessible at
http://ska.dev.wissensbank.com/mod_perl_list/
which provides a link to the module code, access to the logfiles 
involved etc..

Summary :

I wrote a custom PerlAuthenHandler called AM::Authtest.pm.
This handler, at some stage, open a TCP connection to an external 
database server module, sends a message on that connection, reads the 
module's answer on the same connection, and closes the connection.  The 
answer is supposed to indicate if the authentication succeeds.
By and large, according to its logfile, the module seems to be doing 
what it should, in the order it should do it.
The problem is that, although in the PerlAuthHandler (to my knowledge 
and according to the logfile), the TCP connection in the handler is 
opened only once, the external server module seems to see *two* separate 
connections being opened almost simultaneously.  Subsequently what 
*seems* to happen is that the PerlAuthHandler sends the message on one 
of these connections, but tries to read the answer from the other, and 
gets stuck waiting for something that never comes.
I say *seems*, because that's what I guess from the various logfiles, 
although I must say I'm really in the dark here.

Question 1 : has anyone seen this kind of problem before ?

Question 2 : the external server with whom I communicate is a piece of 
code outside my control, and what it logs is a bit limited.
I would gladly try to provide a simplified example of what is happening, 
but for that I would need another TCP server module, to which I could 
open a connection, send something and read a response.  It would have to 
be something that leaves a clear trace of wether one or two connections 
are taking place. (I could use the "echo" port, but that leaves no 
separate trace for instance).
Anyone think of something ?

Thank you in advance.


P.S.
Some data already established by earlier attempts :
- the PerlAuthenHandler module is not pre-loaded at Apache server 
start/restart
- according to the Apache logfiles, the handler is called only once, 
when it should (well, twice in fact but the first time is just returns a 
401 response and does not open a TCP connection)
- opening the TCP connection via IO::Socket::INET, or socket() makes no 
difference, there are always 2 connections instead of one
- reading/writing to the connection via read,sysread,syswrite,send/recv, 
etc.. make no difference
- using a perl "handle" such as SRV or a lexical like "my $SRV" for the 
handle makes no difference
- the same server on which all this is taking place has lots of perl and 
Apache stuff running on it, also with client/server socket stuff, and 
everything else seems to run fine
- I am not perl-guru level, but no beginner either. I have written perl 
TCP client/server applications before, and other Apache2 modules.  But 
this case really has me stumped.




Mime
View raw message