[Mailman-Developers] fork() problem and popen2.py test

Christian Tismer tismer@appliedbiometrics.com
Tue, 09 Mar 1999 23:44:42 +0100


again I had lots of trouble with Mailman on starship.skyport.net .
Mailman was unable to deliver messages, but didn't tell it.

The reason turned out to be dependent wether Python 1.5 (the early
version, of course) was made with threads or not.
The threaded version had a bad effect on sys.stdin after an
os.fork(). sys.stdin was a "bad file number" in the child process.
Maybe these are known things, but there are some issues:

To Guido:
the popen2.py program does a very good job in its self test
procedure. Why is this not included in the standard test suite?
Also, after "make clean" and a new "configure", the problem
did not vanish. I did after a "make distclean".

To the Mailmen:
It was quite hard to track this error down through the
mailman scripts. Finally, I ended up if I made the deliver
fork temporarily into a do-nothing.
The "deliver" script does a number of forks. I does no proper
checking if the forks work (under Linux, btw., fork never returns
ENOMEM, so the check isn't safe yet).
Deliverer.py also trusts the os.popen very much. In my situation,
the error logging was quite random, in three of about 200 tests
I got a "broken pipe" message in the log, in the other cases,
there was just nothing. It seems to be a race condition which
forked process dies first, - I'm not sure.

Anyway, sys.stdin is read without error checking in the
deliver script. I think, some more checks are necessary to guarantee
that failing deliveries get noticed.

The combination of a) threaded Python1.5 behavior and b) too much
trust from Mailman caused me a desperate error search. 
Took me 8 hours to nail it down.

I thought I should tell this, to avoid similar effects for others.

cheers - chris

Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home