python 2.7 & sem_open

Patryk Zawadzki patrys at pld-linux.org
Tue Sep 28 17:11:01 CEST 2010


Multiprocessing seems to be broken in our python packages:

$ python -c 'from multiprocessing.queues import SimpleQueue'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/share/python2.7/multiprocessing/queues.py", line 22, in <module>
  File "/usr/share/python2.7/multiprocessing/synchronize.py", line 33,
in <module>
ImportError: This platform lacks a functioning sem_open
implementation, therefore, the required synchronization primitives
needed will not function, see issue 3770.

Mentioned bug 3770¹ claims that sem_open support is checked for at
build time. The test case is this:

$ cat test.c
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <semaphore.h>
#include <sys/stat.h>

int main(void) {
  sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
  if (a == SEM_FAILED) {
    perror("sem_open");
    return 1;
  }
  sem_close(a);
  sem_unlink("/autoconf");
  return 0;
}
$ gcc test.c -lrt
$ ./a.out ; echo $?
0

It seems our builders don't have semaphore support in their kernels
(or the syscalls are being filtered by some security mechanism).

This results in partially broken python (and renders me unable to use celery).

¹ http://bugs.python.org/issue3770

-- 
Patryk Zawadzki


More information about the pld-devel-en mailing list