apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: apr_os_proc_mutex_get() segfault
Date Mon, 14 Apr 2014 22:37:09 GMT
On Mon, Apr 14, 2014 at 10:19 PM, Jeff Trawick <trawick@gmail.com> wrote:
> dev@apr has an aggravating reply-to setting :(  Please try again to the
> list...
>

Serious CTKI bug, still inverstigating :)

On Sun, Apr 13, 2014 at 8:17 PM, Jeff Trawick <trawick@gmail.com> wrote:
>
> trunk r1587063
> 1.5.x r1587064

Thanks for applying this.

>
> Additionally I left this note as a 2.0 showstopper:
> http://svn.apache.org/viewvc?view=revision&revision=1587066

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.

Regards,
Yann.

Mime
View raw message