win32: disable shared LDAP cache by default

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

win32: disable shared LDAP cache by default

Stefan Sperling
There are numerous reports of Apache HTTPD looping forever on Windows
unless the LDAPSharedCacheSize option is set to zero.

See for instance:
https://svn.haxx.se/users/archive-2014-05/0000.shtml
https://subversion.open.collab.net/ds/viewMessage.do?dsMessageId=564176&dsForumId=3
https://subversion.open.collab.net/ds/viewMessage.do?dsForumId=3&viewType=browseAll&dsMessageId=539507
https://stackoverflow.com/questions/44542654/collabnet-subversion-server-reaching-cpu-100-because-of-httpd-exe-process

I looked around for a while but don't know yet if a corresponding issue
in the HTTPD bug tracker exists. Does anyone know?

On the surface it looks like a memory pool corruption bug to me.
The stack trace posted in https://svn.haxx.se/users/archive-2014-05/0000.shtml
points towards an endless loop in apr_pool_cleanup_kill().
The trace ends at APR-util's misc/apr_reslist.c:apr_reslist_cleanup_order_set,
and of the functions this calls only apr_pool_cleanup_kill() contains loops.

I could not do any further debugging since I only had a production setup
to look at, which is stable with the workaround 'LDAPSharedCacheSize 0'.
I also do not have a Windows dev environment and I don't plan on digging
any further.

Until the real bug gets found and fixed, I would recommend making the
known workaround the default on Windows. Because the winnt MPM runs a
single process, there is no benefit to a shared memory cache anyway.

Should I commit this patch?

Index: modules/ldap/util_ldap.c
===================================================================
--- modules/ldap/util_ldap.c (revision 1803972)
+++ modules/ldap/util_ldap.c (working copy)
@@ -2815,7 +2815,17 @@ static void *util_ldap_create_config(apr_pool_t *p
     apr_thread_mutex_create(&st->mutex, APR_THREAD_MUTEX_DEFAULT, st->pool);
 #endif
 
+#ifdef WIN32
+    /* XXX The shared memory cache can cause an endless loop on Windows.
+     * See https://svn.haxx.se/users/archive-2014-05/0000.shtml and
+     * similar reports elsewhere which recommend 'LDAPSharedCacheSize 0'
+     * as a workaround.
+     * Because the winnt MPM uses a single process a shared cache is
+     * not needed anyway so leave it disabled by default. */
+    st->cache_bytes = 0;
+#else
     st->cache_bytes = 500000;
+#endif
     st->search_cache_ttl = 600000000;
     st->search_cache_size = 1024;
     st->compare_cache_ttl = 600000000;
Reply | Threaded
Open this post in threaded view
|

Re: win32: disable shared LDAP cache by default

Eric Covener
I am hoping this is fixed by
http://svn.apache.org/viewvc?view=revision&revision=182481 which I
stumbled onto from another direction.

On Thu, Aug 3, 2017 at 5:58 AM, Stefan Sperling <[hidden email]> wrote:

> There are numerous reports of Apache HTTPD looping forever on Windows
> unless the LDAPSharedCacheSize option is set to zero.
>
> See for instance:
> https://svn.haxx.se/users/archive-2014-05/0000.shtml
> https://subversion.open.collab.net/ds/viewMessage.do?dsMessageId=564176&dsForumId=3
> https://subversion.open.collab.net/ds/viewMessage.do?dsForumId=3&viewType=browseAll&dsMessageId=539507
> https://stackoverflow.com/questions/44542654/collabnet-subversion-server-reaching-cpu-100-because-of-httpd-exe-process
>
> I looked around for a while but don't know yet if a corresponding issue
> in the HTTPD bug tracker exists. Does anyone know?
>
> On the surface it looks like a memory pool corruption bug to me.
> The stack trace posted in https://svn.haxx.se/users/archive-2014-05/0000.shtml
> points towards an endless loop in apr_pool_cleanup_kill().
> The trace ends at APR-util's misc/apr_reslist.c:apr_reslist_cleanup_order_set,
> and of the functions this calls only apr_pool_cleanup_kill() contains loops.
>
> I could not do any further debugging since I only had a production setup
> to look at, which is stable with the workaround 'LDAPSharedCacheSize 0'.
> I also do not have a Windows dev environment and I don't plan on digging
> any further.
>
> Until the real bug gets found and fixed, I would recommend making the
> known workaround the default on Windows. Because the winnt MPM runs a
> single process, there is no benefit to a shared memory cache anyway.
>
> Should I commit this patch?
>
> Index: modules/ldap/util_ldap.c
> ===================================================================
> --- modules/ldap/util_ldap.c    (revision 1803972)
> +++ modules/ldap/util_ldap.c    (working copy)
> @@ -2815,7 +2815,17 @@ static void *util_ldap_create_config(apr_pool_t *p
>      apr_thread_mutex_create(&st->mutex, APR_THREAD_MUTEX_DEFAULT, st->pool);
>  #endif
>
> +#ifdef WIN32
> +    /* XXX The shared memory cache can cause an endless loop on Windows.
> +     * See https://svn.haxx.se/users/archive-2014-05/0000.shtml and
> +     * similar reports elsewhere which recommend 'LDAPSharedCacheSize 0'
> +     * as a workaround.
> +     * Because the winnt MPM uses a single process a shared cache is
> +     * not needed anyway so leave it disabled by default. */
> +    st->cache_bytes = 0;
> +#else
>      st->cache_bytes = 500000;
> +#endif
>      st->search_cache_ttl = 600000000;
>      st->search_cache_size = 1024;
>      st->compare_cache_ttl = 600000000;



--
Eric Covener
[hidden email]