You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2007/08/17 01:44:58 UTC

DO NOT REPLY [Bug 41142] - Endless loop in apr_allocator_destroy

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41142>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41142





------- Additional Comments From randy@greatplainsmfg.com  2007-08-16 16:44 -------
This is a me too on this issue. This is a problem in apache 2.2.3 and 2.2.4.
I have also "fixed" the problem by hacking up apr_allocator_destroy(). However
my hack is ugly compared to Jens' modification. My environment is as
follows:
Solaris 10 (sparc)
Sun Studio 11 compiler
Apache 2.2.4 (also had problem with 2.2.3)
php 5.2.3
mysql 5.0.45
apr 1.2.9 (I replaced the apr in srclib with 1.2.9)
apr_dbd_mysql.c from http://apache.webthing.com/database

apr is configured with:
configure --prefix=/usr/local/apache2/apr

apr-util is configured with:
configure --with-mysql=/opt/mysql/mysql --with-apr=/usr/local/apache2/apr -
-prefix=/usr/local/apache2/apr-util --with-expat=builtin

apache is configured with:
configure --enable-ssl --with-ssl=/usr/sfw --with-apr=/usr/local/apache2/ap
r --with-apr-util=/usr/local/apache2/apr-util --enable-authn-dbd

apr, apr-util, and apache all configure, compile, and install nicely.

However a few minutes ( 1 -5 minutes) after startup of apache the
httpd process are all consuming cpu and are stuck in an endless loop
in apr_allocator_destroy(). With my "fixed" apr_allocator_destroy()
function the problem is "fixed".


Below is my ugly modified apr_allocator_destroy() function.
This one happens to be from apr 1.2.9.

APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator)
{
    apr_uint32_t index;
    apr_memnode_t *node, **ref;
    apr_memnode_t *old1, *old2;/*rsj 08/25/2006 add this to prevent spinning below*/

    for (index = 0; index < MAX_INDEX; index++) {
        ref = &allocator->free[index];
        while ((node = *ref) != NULL) {
            *ref = node->next;
            /*
                rsj 08/25/2006
                The next 4 lines of code are added by me.
                The purpose is to keep from trying to free the same node
                over and over and over...
                This is what was happening when I attached dbx to an httpd
                process that was using 100% cpu.
                If old == *ref then we have the problem. That is why the if
                statement sets node->next to NULL because the original
                node->next points to its self.
            */
            if(old1 == *ref) node->next = NULL;/*rsj 08/25/2006*/
            if(old2 == *ref) node->next = NULL;/*rsj 08/25/2006*/
            old2 = old1;/*rsj 08/25/2006*/
            old1 = *ref;/*rsj 08/25/2006*/

            free(node);
        }
    }

    free(allocator);
}



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org