Hi,

I've found a problem in FreeBSD's implementation for threads, pth does not 
have this problem.  

The following test case consistantly reproduces the problem:

--- start ---

#! /usr/bin/env python
from subprocess import Popen, PIPE
from threading import Lock, Thread

def runner():
  process = Popen(("make", "-C", "/usr/ports/graphics/kdegraphics4", "clean", 
"all"), close_fds=True)
  process.wait()

# If runner called directly then port compiles correctly, otherwise it stalls
Thread(target=runner).start()

--- end ---

The port stalls with 
<snip/>
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
 - found
===>  Configuring for kdegraphics-4.5.3
/bin/mkdir -p /usr/ports/graphics/kdegraphics4/work/kdegraphics-4.5.3/build
<end/>

The grep errors appear to be mostly harmless, `ps` shows:
<snip/>
17648   4  D      0:00.03 python test.py
17649   4  D      0:00.08 make -C /usr/ports/graphics/kdegraphics4 clean all
17974   4  D      0:00.03 [cmake]
17978   4  Z      0:00.03 <defunct>
<snip/>

I suspect any port using cmake will have this problem (unconfirmed) and if 
memory serves me correct then building lang/perl causes the same problem 
(although the stall happens much later on in the build).  

Using WITH_PTH when building python fixes the problem so I suspect libthr as 
the cause of the problem.  

I hope someone finds this information useful.  

David

P.S. Should a PR be filed for this?
P.S.S. It is possible that one of pythons test cases can reproduce this...

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to