Hm... interesting.

I'm creating the mutex in my post_config hook. It seems like the parent
process has to create the mutex otherwise if we want for a child a race
condition might happen....

Where is the correct place to create the mutex so that it's available to all
child processes without introducing a race condition?

Jason

On Wed, Aug 17, 2011 at 9:39 AM, Ben Noordhuis <i...@bnoordhuis.nl> wrote:

> On Wed, Aug 17, 2011 at 15:20, Jason Funk <jasonlf...@gmail.com> wrote:
> > I am trying to implement an apr proc mutex in my module. When I created
> the
> > mutex with APR_LOCK_DEFAULT the mutex is successfully created but I am
> > getting "Permission Denied" when I try to acquire the lock. I ran
> > "apr_proc_mutex_defname" to get the name of the default mutex type and it
> > is APR_LOCK_SYSVSEM. Without changing anything else, I changed
> > APR_LOCK_DEFAULT to APR_LOCK_POSIXSEM when creating the mutex, just to
> see
> > what happens and everything works fine. Of course, this isn't portable.
> Any
> > ideas why APR_LOCK_SYSVSEM doesn't work, but APR_LOCK_POSIXSEM does work?
>
> I suspect that you see shmget() raising EACCES when you strace apache?
> That's what happens when you create the mutex as root and try to
> acquire it after httpd's dropped privileges, apr creates the semaphore
> with mode 0600.
>

Reply via email to