You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Yann Ylavic <yl...@gmail.com> on 2014/06/17 23:57:17 UTC

Re: apr_os_proc_mutex_get() segfault

Is there any chance this could be integrated into 1.6, or any fix that
allows apr_os_proc_mutex_put/get() on posix semaphores (sem_t)?

Regards,
Yann.

On Tue, Apr 15, 2014 at 12:37 AM, Yann Ylavic <yl...@gmail.com> wrote:
> Also, it seems that the posix sems (ie. sem_t from semaphore.h) are
> handled as a file descriptor by apr_os_proc_mutex_get/set(), instead
> of the native sem_t.
>
> I tried to address all the issues related to proc_mutex (different)
> interfaces in the attached patch (v3, since v1 and v2 were already
> sent privatly to Jeff... I take this opportunity to modify
> slightly/accordingly the description below).
>
> I came up with this changes :
> 1. Add "sem_t *psem_interproc" to the end of the apr_os_proc_mutex_t
> struct (the only public API change),
> 2. Handle this new field in apr_os_proc_mutex_get/set() when
> APR_HAS_POSIXSEM_SERIALIZE,
> 3. Use "apr_os_proc_mutex_t *os" in the private unix(es)
> apr_proc_mutex_t struct instead of duplicating all its fields,
> 4. When the apr_proc_mutex_t's "apr_file_t *interproc" field is needed
> (only APR_HAS_FCNTL_SERIALIZE or APR_HAS_FLOCK_SERIALIZE now), set
> "os->crossproc = interproc->filedes" so that we can use only os'
> fields in all the native functions,
> 5. Depending on how the apr_proc_mutex_t->interproc was created
> (apr_proc_mutex_create()::apr_file_open() vs
> apr_os_proc_mutex_put()::apr_os_file_put() cases), we have to simply
> apr_file_close() the interproc or also close the os->crossproc (this
> is to keep consistency with others proc_mutex implementations which
> close/destroy their underlying OS objects on cleanup, whether
> _create() or _put() was used),
> 6. Fix the Netware and OS2 apr_os_proc_mutex_get() returned status,
> and implement apr_os_proc_mutex_set() on Netware.
> 7. Add static APR_INLINE apr_os_proc_mutex_reset() to reset the
> corresponding struct (NULL pointers, but mainly -1 for the file
> descriptor used by flock/fcntl), eg. before setting the only field to
> be used by apr_os_proc_mutex_put().
>
> For points 1 and 7, I don't know if this is backportable to 1.x, these
> are API changes...
> I can't tell either if the type of the os_mutex is needed in the
> struct (as a separate field), the doc could impose every field to be
> NULL/-1 but the used (native) type, or use 7 for that.

Re: apr_os_proc_mutex_get() segfault

Posted by Yann Ylavic <yl...@gmail.com>.
Actually I created a dedicated thread [1] for this issue, since it was
quite out of topic here.
Moreover I was about to update that thread with a new patch (taking
into account the latest changes on proc_mutex, ie.
APR_LOCK_DEFAULT_TIMED introduced with
apr_{proc,thread}_mutex_timedlock).

So I continue there...

Regards,
Yann.

[1] http://mail-archives.apache.org/mod_mbox/apr-dev/201410.mbox/%3CCAKQ1sVPp74h8EROkqDXvqo9JaMmq0op-Zskj6Xv=TZGp4z287A@mail.gmail.com%3E


On Tue, Mar 24, 2015 at 8:29 PM, William A. Rowe Jr.
<wr...@rowe-clan.net> wrote:
> I'm crawling back through emails pended while I was handling my late
> father's affairs last year.  Is this still something that needs more
> eyeballs?
>
> Bill
>
>
> On Tue, 17 Jun 2014 23:57:17 +0200
> Yann Ylavic <yl...@gmail.com> wrote:
>
>> Is there any chance this could be integrated into 1.6, or any fix that
>> allows apr_os_proc_mutex_put/get() on posix semaphores (sem_t)?
>>
>> Regards,
>> Yann.
>>
>> On Tue, Apr 15, 2014 at 12:37 AM, Yann Ylavic <yl...@gmail.com>
>> wrote:
>> > Also, it seems that the posix sems (ie. sem_t from semaphore.h) are
>> > handled as a file descriptor by apr_os_proc_mutex_get/set(), instead
>> > of the native sem_t.
>> >
>> > I tried to address all the issues related to proc_mutex (different)
>> > interfaces in the attached patch (v3, since v1 and v2 were already
>> > sent privatly to Jeff... I take this opportunity to modify
>> > slightly/accordingly the description below).
>> >
>> > I came up with this changes :
>> > 1. Add "sem_t *psem_interproc" to the end of the apr_os_proc_mutex_t
>> > struct (the only public API change),
>> > 2. Handle this new field in apr_os_proc_mutex_get/set() when
>> > APR_HAS_POSIXSEM_SERIALIZE,
>> > 3. Use "apr_os_proc_mutex_t *os" in the private unix(es)
>> > apr_proc_mutex_t struct instead of duplicating all its fields,
>> > 4. When the apr_proc_mutex_t's "apr_file_t *interproc" field is
>> > needed (only APR_HAS_FCNTL_SERIALIZE or APR_HAS_FLOCK_SERIALIZE
>> > now), set "os->crossproc = interproc->filedes" so that we can use
>> > only os' fields in all the native functions,
>> > 5. Depending on how the apr_proc_mutex_t->interproc was created
>> > (apr_proc_mutex_create()::apr_file_open() vs
>> > apr_os_proc_mutex_put()::apr_os_file_put() cases), we have to simply
>> > apr_file_close() the interproc or also close the os->crossproc (this
>> > is to keep consistency with others proc_mutex implementations which
>> > close/destroy their underlying OS objects on cleanup, whether
>> > _create() or _put() was used),
>> > 6. Fix the Netware and OS2 apr_os_proc_mutex_get() returned status,
>> > and implement apr_os_proc_mutex_set() on Netware.
>> > 7. Add static APR_INLINE apr_os_proc_mutex_reset() to reset the
>> > corresponding struct (NULL pointers, but mainly -1 for the file
>> > descriptor used by flock/fcntl), eg. before setting the only field
>> > to be used by apr_os_proc_mutex_put().
>> >
>> > For points 1 and 7, I don't know if this is backportable to 1.x,
>> > these are API changes...
>> > I can't tell either if the type of the os_mutex is needed in the
>> > struct (as a separate field), the doc could impose every field to be
>> > NULL/-1 but the used (native) type, or use 7 for that.
>