Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Nov 2010 23:21:17 +0200
From:      David Naylor <naylor.b.david@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   python + build ports = failure (threading problem)
Message-ID:  <201011102321.23883.naylor.b.david@gmail.com>

next in thread | raw e-mail | index | archive | help
--nextPart2403325.53z0r8NQuq
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

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

The following test case consistantly reproduces the problem:

=2D-- start ---

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

def runner():
  process =3D Popen(("make", "-C", "/usr/ports/graphics/kdegraphics4", "cle=
an",=20
"all"), close_fds=3DTrue)
  process.wait()

# If runner called directly then port compiles correctly, otherwise it stal=
ls
Thread(target=3Drunner).start()

=2D-- end ---

The port stalls with=20
<snip/>
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
 - found
=3D=3D=3D>  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=
=20
memory serves me correct then building lang/perl causes the same problem=20
(although the stall happens much later on in the build). =20

Using WITH_PTH when building python fixes the problem so I suspect libthr a=
s=20
the cause of the problem. =20

I hope someone finds this information useful. =20

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...

--nextPart2403325.53z0r8NQuq
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iEYEABECAAYFAkzbDNMACgkQUaaFgP9pFrIGyQCePFdi2mt7W4v1lJdmc4iuHWed
gEgAnjz6MKiKNgOwBITvBRPa7Xzx/Kt5
=/PkM
-----END PGP SIGNATURE-----

--nextPart2403325.53z0r8NQuq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011102321.23883.naylor.b.david>