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 sable
Recipients sable
Date 2007-10-04.09:18:54
SpamBayes Score 0.00864457
Marked as misclassified No
Message-id <>
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: The Written Word (Albert Chin) (tww-china)
Assigned to: Nobody/Anonymous (nobody)
Summary: semaphore errors from Python 2.3.x on AIX 5.2

Initial Comment:
Newer versions of the AIX 5.2 libc implement POSIX
semaphores and thus define _POSIX_SEMAPHORES in
<unistd.h>. However, when building Python 2.3.x (and
I'm sure any other version with sem_init()), a few
semaphore errors are encountered:
  building 'pcre' extension
  ./Modules/ld_so_aix gcc -bI:Modules/python.exp  
-L/opt/TWWfsw/python232/lib/support -Wl,-brtl  
build/temp.aix-5.2-2.3/pcremodule.o   build/temp.aix-5.2-2.3/pypcre.o
-L/opt/TWWfsw/python232/lib   -o build/lib.aix-5.2-2.3/
  sem_trywait: Permission denied
  sem_wait: Permission denied
  sem_post: Permission denied

I ran the Python process under truss and saw that the
sem_init() from Python/thread_pthread.h worked
successfully. fork() was then called and a
sem_trywait() operation (probably from
PyThread_acquire_lock()) was called. From the
sem_init() man page
  If the pshared parameter has a nonzero value, the
  is shared between processes. In this case, any
process that can
  access the sem parameter can use it for performing
  sem_trywait, sem_post, and sem_destroy operations.

  Only the sem parameter itself may be used for performing

  If the pshared parameter is zero, the semaphore is
shared between
  threads of the process. Any thread in this process
can use the sem
  parameter for performing sem_wait, sem_trywait,
sem_post, and
  sem_destroy operations. The use of the semaphore by
  other than those created in the same process returns
an error.

Setting the 2nd value of sem_init to 1 (was 0) solved
the problem. However, I don't know if this is wise for
security. Another solution is to set


Comment By: Leanid (lim_1)
Date: 2005-06-20 13:12

Logged In: YES 

I can confirm this problem. I am using scons to build my 
project on AIX. I could not run parallel builds (-j4) on AIX. 
Randomly, but very often xlC invocation would stuck and I 
have 4 xlCcode hanging and taking all CPUs.

AIX and rebuilding Python parallel builds on AIX are fine. 
Trying first fix with changing 0 to 1 in sem_init also resolved 
this problem, but I started to get some other unexplained 
error from scons, so had to deactivate semaphores all 

Albert, thanks for this report, it helped a lot.

Date User Action Args
2007-10-04 09:18:57sablesetspambayes_score: 0.00864457 -> 0.00864457
recipients: + sable
2007-10-04 09:18:56sablesetspambayes_score: 0.00864457 -> 0.00864457
messageid: <>
2007-10-04 09:18:56sablelinkissue1234 messages
2007-10-04 09:18:54sablecreate