[Python-Dev] bug in python arm-linux?: start_new_thread fails after popen

Michael Lauer mickey at tm.informatik.uni-frankfurt.de
Wed Dec 17 09:01:00 EST 2003


Hi, I have a python program which works fine on x86 but doesn't work on
any of my arm-linux devices (Zaurus, Ipaq, SIMpad) - all of them are
running Python 2.3.2 on top of glibc 2.3.2+linuxthreads on top of kernel
2.4.18-rmk6-pxa3 respectively kernel 2.4.19-rmk7.

After a long week of debugging I now can reproduce the behaviour with
the following minimal case:

----------------------------------------------------------------------
import thread
from time import sleep
import sys
import os

def createPipe():
    print os.popen( "ls -l" ).read()

def threadMain( name ):
    while True:
        sys.stderr.write( name+": i'm still running" )
        sys.stderr.flush()
        sleep( 1 )

if __name__ == '__main__':

    createPipe()

    print "BEFORE start_new_thread"
    thread.start_new_thread( threadMain, ( "1", ) )
    print "AFTER start_new_thread"

    createPipe()

    print "BEFORE start_new_thread"
    thread.start_new_thread( threadMain, ( "2", ) )
    print "AFTER start_new_thread"

sleep( 5 )
-----------------------------------------------------------------------

This program - as is - just hangs in the first start_new_thread() and
never comes back.
If you outcomment the first call to createPipe() out, then it works
fine.

In the first - hanging - case, an strace shows:
-------------------------------------------------------------------------
write(1, "BEFORE start_new_thread\n", 24BEFORE start_new_thread
) = 24
rt_sigprocmask(SIG_BLOCK, ~[33], [RTMIN], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0x14e080,
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 949
write(4, "\314V\1@\5\0\0\0\0\0\0\0\0\0\0\0\34\213\37@\10c\1@\0\0"...,
148) = 148
rt_sigprocmask(SIG_SETMASK, NULL, ~[KILL STOP 33], 8) = 0
write(4, "\0\21\3@\0\0\0\0\0\0\0\0hO\n\0\2503\23\0\377\376\373\377"...,
148) = 148
rt_sigprocmask(SIG_SETMASK, NULL, ~[KILL STOP 33], 8) = 0
rt_sigsuspend(~[KILL STOP RTMIN 33]
--------------------------------------------------------------------------
The program must be kill -9'ed at this point.

Can anyone explain this behaviour to me - did I find a bug?

Sincerely,

-- 
:M:
--------------------------------------------------------------------------
Dipl.-Inf. Michael 'Mickey' Lauer   mickey at tm.informatik.uni-frankfurt.de 
  Raum 10b - ++49 69 798 28358       Fachbereich Informatik und Biologie  
--------------------------------------------------------------------------




More information about the Python-Dev mailing list