[Zope-dev] PCGI bug (Was: Zope-2.1.0b2 fails on access to management screen)

Martijn Pieters mj@antraciet.nl
Tue, 23 Nov 1999 00:02:01 +0100


Jim Cain wrote:
> >> Then I tried removing things altogether, one at a time. Finally I
> >> discovered that by removing the first %d on line 225 and self.addr[1] on
> >> line 226, while leaving everything else alone, it works fine.
> >>
> >> One curious thing though: When I run it this way, the line it writes in
> >> the log file begins with ^D. Where is that character coming from?

Then I wrote something that amounts to
> >          import pdb
> >          pdb.set_trace()
> >
> > somewhere before the offending lines (for example, at 222), start Zope in
> > debugging mode (so it won't detach from the console).
> >
> > Let us know!
>


And Jim then wrote
>Okay, I put in the set_trace, and this is what I found:
>
>(Pdb) l
>220             else:
>221                 method="GET"
>222             if self.addr:
>223                 import pdb
>224                 pdb.set_trace()
>225  ->             self.server.logger.log (
>226                     self.addr[0],
>227                     '%d - - [%s] "%s %s" %d %d' % (
>228                         self.addr[1],
>229                         time.strftime (
>230                         '%d/%b/%Y:%H:%M:%S ',
>(Pdb) whatis self.addr
><type 'string'>
>(Pdb) p self.addr
>'\004\010\204\364\377\277\226y'
>(Pdb) p self.addr[0]
>'\004'
>(Pdb) p self.addr[1]
>'\010'
>
>Well at least we know where the ^D is coming from, but what is self.addr
>supposed to contain, a string representation of the IP address of the
>client?

Hmm.. And this means, what I can make out, that you now have a AF_UNIX type 
socket and address, and that address is a string, but the code expects a 
AF_INET type socket and address, whose address is a (host, port) pair.

Which leaves us with the question, how did you end up with a AF_UNIX type 
socket instead of a AF_INET type? And why doesn't the code in PCGIServer.py 
account for the possibility?

You probably switched from Inet sockets to Unix sockets in the meantime, 
right? Does ZServer start up with a message like 'PCGI Server started at 
... Inet socket port: ...' or does it say 'Unix Socket: ...'?

As PCGIServer works with both types of sockets, this logging thing is a 
bug. Report it at the Collector:

   http://classic.zope.org:8080/Collector/


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------