You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by NormW <no...@gknw.net> on 2011/05/10 01:50:58 UTC

apr_pool_parent_get and NetWare

Greetings,
The apr_pool_parent_get() when working for NetWare, returns the same 
pool pointer passed in when at its highest desired level, which isn't 
the real 'top'.

> APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
> {
> #ifdef NETWARE
>     /* On NetWare, don't return the global_pool, return the application pool
>        as the top most pool */
>     if (pool->parent == global_pool)
>         return pool;
>     else
> #endif
>     return pool->parent;
> }

As this pool still has a valid parent pointer there are several places 
in the apr source where this causes a server hang due to getting stuck 
in a loop. From mod_dbd.c for example:

>     /* Top level pool scope, need process-scope lifetime */
>     for (parent = pool;  parent; parent = apr_pool_parent_get(pool))
>          pool = parent;

The 'desirable' solution (I think) would be for apr_pool_parent_get() to 
return (in the NetWare-specific case) something that allows these loops 
to properly terminate (only 1 file to change), or else (though less 
attractive) would be to revise all the loops along the following lines:

>     /* Top level pool scope, need process-scope lifetime */
>     parent = pool;
>     while (parent) {
>         pool   = parent;
>         parent = apr_pool_parent_get(pool);
> #ifdef NETWARE
>         /* On NetWare, if parent returned == pool, we're at the top */
>         if (parent == pool)
>             break;
> #endif
>     }

The loops are in mod_dbd.c, mod_dbm.c, mod_dso.c and mod_crypto.c.

Norm.