This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hongxu
Recipients hongxu
Date 2017-08-10.07:21:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502349716.95.0.155037219321.issue31171@psf.upfronthosting.co.za>
In-reply-to
Content
To build python for embedded Linux systems,
(http://www.yoctoproject.org/docs/2.3.1/yocto-project-qs/yocto-project-qs.html)
The 32-bit python's multiprocessing.BoundedSemaphore could not work.

1. Prerequisite
- Build 32bit python on 64bit host, add '-m32' to gcc

- Cross compling on linux platform, not have `-pthread'
  In configure.ac, ac_cv_pthread=no while cross compiling
  ...
  2001 AC_MSG_CHECKING(whether $CC accepts -pthread)
  2002 AC_CACHE_VAL(ac_cv_pthread,
  2003 [ac_save_cc="$CC"
  2004 CC="$CC -pthread"
  2005 AC_RUN_IFELSE([AC_LANG_SOURCE([[
  [snip]
  2018 ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
  ...

  — Macro: AC_RUN_IFELSE (input, [action-if-true], [action-if-false], [action-if-cross-compiling])

2. Reproduce with simplifying the prerequisite

$ git clone https://github.com/python/cpython.git; cd ./cpython

$ ac_cv_pthread=no CC="gcc -m32" ./configure

$ make -j 10

$ ./python -c "import multiprocessing; pool_sema = multiprocessing.BoundedSemaphore(value=1); pool_sema.acquire(); pool_sema.release()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: semaphore or lock released too many times

And the issue also caused invoking put of 'multiprocessing.Queue' hung.
$ ./python -c "import multiprocessing; queue_instance = multiprocessing.Queue(); queue_instance.put(('install'))"
History
Date User Action Args
2017-08-10 07:21:56hongxusetrecipients: + hongxu
2017-08-10 07:21:56hongxusetmessageid: <1502349716.95.0.155037219321.issue31171@psf.upfronthosting.co.za>
2017-08-10 07:21:56hongxulinkissue31171 messages
2017-08-10 07:21:56hongxucreate