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 2006/12/10 13:34:56 UTC

DO NOT REPLY [Bug 41142] New: - 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

           Summary: Endless loop in apr_allocator_destroy
           Product: Apache httpd-2
           Version: 2.2.3
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Keywords: PatchAvailable
          Severity: blocker
          Priority: P1
         Component: Core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: jens@strawberry.com


The function apr_allocator_destroy removes pool nodes
from memory. Those nodes are organized as a chain in which 
each node points to the subsequent one using its 'next'
member.

If mod_dbd in conjunction with apr_dbd_pgsql is in use it
happens, that the 'next' pointer of a node points to the
node itsself. This introduces an endless loop consuming 100%
of CPU.

The problem IMHO is introduced into the chain of nodes at
some other location. However as a workaround I've applied the
following patch to the destroy function to become aware of
the problem and treat it correctly:

*** ./srclib/apr/memory/unix/apr_pools.c.fcs    Sun Dec 10 12:44:28 2006
--- ./srclib/apr/memory/unix/apr_pools.c        Sun Dec 10 12:45:52 2006
***************
*** 107,112 ****
--- 107,115 ----
      for (index = 0; index < MAX_INDEX; index++) {
          ref = &allocator->free[index];
          while ((node = *ref) != NULL) {
+           /* jens 2006/12/10 - this should not happen, however it intro-
+              duced endless loops when apr_dbd_pgsql is in use */
+           if( node->next == node) node->next = NULL;
              *ref = node->next;
              free(node);
          }

This problem is a blocking point for Apache utilizing PostgreSQL
as authentication provider.

-- 
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


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

Posted by bu...@apache.org.
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


hpw@hp-weidinger.at changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hpw@hp-weidinger.at




-- 
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


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

Posted by bu...@apache.org.
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


jorton@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugs@apr.apache.org         |bugs@httpd.apache.org
             Status|REOPENED                    |NEW
          Component|APR                         |mod_dbd
            Product|APR                         |Apache httpd-2
            Version|1.2.7                       |2.2.3




------- Additional Comments From jorton@redhat.com  2006-12-11 06:50 -------
Lacking any further reproduction information beyond "mod_dbd causes heap
corruption" there is not much point keeping the bug open.  There is certainly no
bug in APR described here.

If the symptoms of your bug match bug 39985 could you try the patch Chris posted
there?

Otherwise could you describe how and when mod_dbd is failing, how it was
configured, how you built the server, etc?

-- 
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


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

Posted by bu...@apache.org.
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


nick@webthing.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From nick@webthing.com  2007-10-07 18:12 -------
Believed obsoleted.  Reported as fixed.

-- 
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


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

Posted by bu...@apache.org.
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 hpw@hp-weidinger.at  2007-03-13 05:21 -------
I had a simmilar Problem with apr when destroying a pool twice.
(Call apr_pool_destroy twice on the same pool).

This causes the allocators "free" list to be corrupted.

Next time, you call 
apr_pool_create(newpool,NULL)
apr_pool_create(newpool2,newpool) you get 2 identical nodes, where
parent and child seem to be self-references.

in allocator_destroy (called by apr_terminate) this leads to an endless loop.

Maybe it would help to enhance the apr-functions with debug output.

-- 
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


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

Posted by bu...@apache.org.
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


jorton@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From jorton@redhat.com  2006-12-11 07:04 -------
Blerg, sorry, wrong bug.

-- 
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


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

Posted by bu...@apache.org.
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


jorton@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From jorton@redhat.com  2006-12-11 07:03 -------
Please report problems with libapreq to apreq-dev@httpd.apache.org; I've
forwarded this message.

-- 
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


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

Posted by bu...@apache.org.
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


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

Posted by bu...@apache.org.
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


nick@webthing.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO




------- Additional Comments From nick@webthing.com  2007-09-07 17:52 -------
Do you still have a problem with 2.2.6?

-- 
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


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

Posted by bu...@apache.org.
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 jens@strawberry.com  2006-12-12 13:32 -------
Hi,

I tried the patch posted in issue 39985 but it did not help.
I've installed the source tree and the development environment
on one of my public servers. I may offer to drag this down
together ...

Jens

-- 
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


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

Posted by bu...@apache.org.
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


rpluem@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugs@httpd.apache.org       |bugs@apr.apache.org
          Component|Core                        |APR
            Product|Apache httpd-2              |APR
            Version|2.2.3                       |1.2.7




------- Additional Comments From rpluem@apache.org  2006-12-10 04:46 -------
Reclassify as APR bug

-- 
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


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

Posted by bu...@apache.org.
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-09-28 14:36 -------
Apache 2.2.6 has fixed this bug for me!!! I have now been running 2.2.6 for
several days now without a problem.

Thanks a bazillion goes to whoever fixed this issue.
Randy Jones

-- 
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


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

Posted by bu...@apache.org.
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


randy@greatplainsmfg.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |randy@greatplainsmfg.com




-- 
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