sem(4) lockup in python?

Daniel Eischen deischen at freebsd.org
Sun Feb 5 19:29:50 UTC 2012


On Sun, 5 Feb 2012, Jilles Tjoelker wrote:

> On Sun, Feb 05, 2012 at 01:32:42PM -0500, Daniel Eischen wrote:
>> On Sun, 5 Feb 2012, Ivan Voras wrote:
>>> On 5 February 2012 11:44, Garrett Cooper <yanegomi at gmail.com> wrote:
>
>>>>    'make MAKE_JOBS_NUMBER=1' is the workground used right now..
>
>>> David Xu suggested that it is a bug in Python - it doesn't set
>>> process-shared attribute when it calls sem_init(), but i've tried
>>> patching it (replacing the port patchfile file the one I've attached)
>>> and I still get the hang.
>
>> I don't understand how process shared semaphores can work.  Perhaps
>> I'm dumb and ignorant, but a sem_id_t is an allocated struct.   The
>> actual kernel sem_id is inside the struct.  Isn't this the same
>> reason pthread_mutex_t and pthread_cond_t cannot be process-shared?
>
> That's how the old implementation works. It does not support
> process-shared semaphores although they may happen to work in some
> specific cases.
>
> However, in 9.0, sem_t works differently and contains the actual lock
> word directly, so that process-shared semaphores work. The
> implementation is in lib/libc/gen/sem_new.c. The pshared flag to
> sem_init() is not a no-op because it tells the kernel to allow for use
> from multiple processes.
>
> Note that the old implementation is still present as well, for
> compatibility with old binaries.

Ahh, okay, I was looking at the old implementation in libc.

-- 
DE


More information about the freebsd-hackers mailing list