You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ronen Mizrahi <ro...@tversity.com> on 2012/02/07 00:47:11 UTC

Crash in apr_proce_create()

Hi,

We have been porting an existing APR based application to Mac OS and ran
into a crash problem on Mac when executing apr_proc_create() (no crash
was occurring on Windows)

After some investigation we found that run_child_cleanups (which is invoked
by apr_pool_cleanup_for_exec) was crashing due to the fact that
c->child_cleanup_fn was NULL.

For the time being we resolved it by adding an if not NULL statement before
invoking the cleanup function however I am not sure that a NULL cleanup
function is allowed or by itself represents some kind of an issue.

If it is allowed or can happen under normal conditions then I will be glad
to submit a patch, if it is not allowed I would appreciate any insights as
to what could have caused this scenario.

Best,

Ronen Mizrahi
TVersity

Re: Crash in apr_proce_create()

Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Feb 6, 2012 at 7:00 PM, Ronen Mizrahi <ro...@tversity.com> wrote:
>
>
> On Mon, Feb 6, 2012 at 6:54 PM, Bojan Smojver <bo...@rexursive.com> wrote:
>>
>> On Mon, 2012-02-06 at 18:47 -0500, Ronen Mizrahi wrote:
>> > For the time being we resolved it by adding an if not NULL statement
>> > before invoking the cleanup function however I am not sure that a NULL
>> > cleanup function is allowed or by itself represents some kind of an
>> > issue.
>>
>> Have you tried setting you cleanup function to apr_pool_cleanup_null()?
>> See:
>>
>>
>> http://apr.apache.org/docs/apr/1.4/group___pool_cleanup.html#gaa211acee585df08f396a50b0ea489b02
>>
>> --
>> Bojan
>>
>
> I am afraid I do not understand how this is relevant.

It is not valid to pass NULL for a cleanup function.
>
> The pool cleanup functions in the parent process are registered correctly
> and work fine even when releasing the global pool (which happens when the
> process terminates).
>
> Only in the child process we run into this issue and we cannot change the
> registrations of cleanup functions in the child process since the crash
> occurs somewhere between the invocation of fork() and the invocation of
> exec().

It is the registration in the parent which matters.  Please confirm
that you use apr_pool_cleanup_null() as the cleanup function whenever
you don't have any code to run.

>
> Ronen
>



-- 
Born in Roswell... married an alien...

Re: Crash in apr_proce_create()

Posted by Bojan Smojver <bo...@rexursive.com>.
On Mon, 2012-02-06 at 19:00 -0500, Ronen Mizrahi wrote:
> Only in the child process we run into this issue and we cannot change
> the registrations of cleanup functions in the child process since the
> crash occurs somewhere between the invocation of fork() and the
> invocation of exec().

Best thing to do:

- open a bug report
- attach a stack trace
- point to the bug report in this thread

-- 
Bojan


Re: Crash in apr_proce_create()

Posted by Ronen Mizrahi <ro...@tversity.com>.
On Mon, Feb 6, 2012 at 6:54 PM, Bojan Smojver <bo...@rexursive.com> wrote:

> On Mon, 2012-02-06 at 18:47 -0500, Ronen Mizrahi wrote:
> > For the time being we resolved it by adding an if not NULL statement
> > before invoking the cleanup function however I am not sure that a NULL
> > cleanup function is allowed or by itself represents some kind of an
> > issue.
>
> Have you tried setting you cleanup function to apr_pool_cleanup_null()?
> See:
>
>
> http://apr.apache.org/docs/apr/1.4/group___pool_cleanup.html#gaa211acee585df08f396a50b0ea489b02
>
> --
> Bojan
>
>
I am afraid I do not understand how this is relevant.

The pool cleanup functions in the parent process are registered correctly
and work fine even when releasing the global pool (which happens when the
process terminates).

Only in the child process we run into this issue and we cannot change the
registrations of cleanup functions in the child process since the crash
occurs somewhere between the invocation of fork() and the invocation of
exec().

Ronen

Re: Crash in apr_proce_create()

Posted by Bojan Smojver <bo...@rexursive.com>.
On Mon, 2012-02-06 at 18:47 -0500, Ronen Mizrahi wrote:
> For the time being we resolved it by adding an if not NULL statement
> before invoking the cleanup function however I am not sure that a NULL
> cleanup function is allowed or by itself represents some kind of an
> issue. 

Have you tried setting you cleanup function to apr_pool_cleanup_null()?
See:

http://apr.apache.org/docs/apr/1.4/group___pool_cleanup.html#gaa211acee585df08f396a50b0ea489b02

-- 
Bojan