Python 1.6a2 crashes in test_fork1 on my Mandrake Linux 7 machine

Chad Netzer cnetzer at stanford.edu
Wed Apr 19 04:47:45 EDT 2000


Well, as a followup to my last message, I recompiled my kernel for single-CPU
operation (I have a dual CPU machine), and was able to pass the "test_fork1.py" test
each time, so there appears to be a problem w/ threads on dual CPUs.  Whether it is
specific to Linux, Glibc, or Python's threadmodule, I have no idea.  But anyone else
with a dual CPU Linux (or other) setup would be a big help if they reported their
results. (Note, I tested this under Linux kernel 2.3.99pre5 and 2.2.15, with the
same results.  I'm using Glibc 2.1.3)

Neil Schemenauer sent me the following code, which demonstrates a problem quite
clearly.  It locks up on me in dual-CPU mode, but works fine in single-CPU mode.

I'll investigate more if I can, but learning about PDEs is keeping me very busy. :)

Chad Netzer
cnetzer at stanford.edu

--------------- [ cut here ] ----------------

import threading
import os, sys

class MyThread(threading.Thread):
    def start(self):
        threading.Thread.start(self)

    def run(self):
        while 1:
            if os.fork() == 0:
                print os.getpid()
                os._exit(0)
            os.wait()

MyThread().start()
MyThread().start()
MyThread().start()





More information about the Python-list mailing list