<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>PHP process hangs drawing 100% CPU until killed</title> 
  <pubDate>Fri, 10 Apr 2026 10:04:39 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/11041</link> 
  <atom:link rel="self" type="application/rss+xml" title="PHP process hangs drawing 100% CPU until killed" href="https://bugs.horde.org/ticket/11041/rss" /> 
  <description>PHP process hangs drawing 100% CPU until killed</description> 
 
   
   
  <item> 
   <title>Helo,

since upgrading to IMP 5.X we experience the follow</title> 
   <description>Helo,

since upgrading to IMP 5.X we experience the following issue:

Sporadically one PHP process draws 100% CPU until it reaches max_execution_time. This happens &gt; 10 times per day on a busy System serving &gt;100k e-mail-accounts. php errorlog shows that the script reaches max_execution time while it is in different parts of imp/lib/Imap/Tree.php like this:

[27-Feb-2012 10:59:07] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1709

You can find more lines from the errorlog below.

strace on the process that draws 100% CPU does not show anything so not syscalls are executed.

Environment: PHP5.3.10, APC. (We got the same behaviour with 5.2.X and eaccelerator)

To further diagnose this issue we ran the attached patch (&quot;diagnose_patch.diff&quot;)

This will alert us if a certain loop in Tree.php gets executed 1.000 times and save print_r of debug_backtrace to a file. We have verified at least one instance where this code gets triggered for a process that suffers from the 100% CPU problem and gets killed after reaching max_execution_time. You can find the output for this process in &quot;daignose_output.txt&quot;.

As far as we can tell there seems to be loop in the code of Tree.php, specifically in getPollList: The foreach does not ever seem to exit in our case.

Unfortunately we do not know how to continue in solving this problem. Can you please point us into the right direction? We are willing to run more diagnostic code to further narrow down the root cause of this elusive problem.





Some output from php errorlog:

[27-Feb-2012 10:42:04] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 829
[27-Feb-2012 10:43:13] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1708
[27-Feb-2012 10:44:19] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/framework/Prefs/lib/Horde/Prefs.php on line 317
[27-Feb-2012 10:44:41] PHP Fatal error:  Call to a member function getName() on a non-object in horde-git/imp/lib/Ajax/Application.php on line 1349
[27-Feb-2012 10:44:52] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1827
[27-Feb-2012 10:45:11] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1827
[27-Feb-2012 10:45:52] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1676
[27-Feb-2012 10:45:54] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1827
[27-Feb-2012 10:45:59] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1279
[27-Feb-2012 10:46:00] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1709
[27-Feb-2012 10:46:04] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1277
[27-Feb-2012 10:46:07] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1709
[27-Feb-2012 10:46:07] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1709
[27-Feb-2012 10:46:15] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/framework/Prefs/lib/Horde/Prefs/Scope.php on line 138
[27-Feb-2012 10:46:16] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1277
[27-Feb-2012 10:51:09] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1277
[27-Feb-2012 10:51:11] PHP Fatal error:  Call to a member function getName() on a non-object in horde-git/imp/lib/Ajax/Application.php on line 1349
[27-Feb-2012 10:54:41] PHP Fatal error:  Call to a member function getName() on a non-object in horde-git/imp/lib/Ajax/Application.php on line 1349
[27-Feb-2012 10:57:34] PHP Fatal error:  Call to a member function getName() on a non-object in horde-git/imp/lib/Ajax/Application.php on line 1349
[27-Feb-2012 10:58:45] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1827
[27-Feb-2012 10:58:50] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1826
[27-Feb-2012 10:59:07] PHP Fatal error:  Maximum execution time of 300 seconds exceeded in horde-git/imp/lib/Imap/Tree.php on line 1709
</description> 
   <pubDate>Wed, 29 Feb 2012 10:38:17 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70521</link> 
  </item> 
   
  <item> 
   <title>Attached is the output of our patch, diagnose_output.txt</title> 
   <description>Attached is the output of our patch, diagnose_output.txt</description> 
   <pubDate>Wed, 29 Feb 2012 10:40:59 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70522</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git (master):

commit 0f8e19b5982e</title> 
   <description>Changes have been made in Git (master):

commit 0f8e19b5982e5d078195800a4e7af78b8956f893
Author: Michael M Slusarz &lt;slusarz@horde.org&gt;
Date:   Wed Feb 29 16:49:05 2012 -0700

    Bug #11041: If mailbox listing fails, this needs to be a fatal error since the IMAP tree cannot be built correctly.

 imp/lib/Imap/Tree.php |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

http://git.horde.org/horde-git/-/commit/0f8e19b5982e5d078195800a4e7af78b8956f893</description> 
   <pubDate>Wed, 29 Feb 2012 23:49:29 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70552</link> 
  </item> 
   
  <item> 
   <title>Your tree object is very broken:

                    [_tr</title> 
   <description>Your tree object is very broken:

                    [_tree:protected] =&gt; Array
                        (
                            [base] =&gt; Array
                                (
                                    [a] =&gt; 0
                                    [v] =&gt; base
                                )

                            [vfolder] =&gt; Array
                                (
                                    [a] =&gt; 385
                                    [c] =&gt; 0
                                    [p] =&gt; base
                                    [v] =&gt; vfolder
                                )

                            [impsearchvinbox] =&gt; Array
                                (
                                    [a] =&gt; 136
                                    [c] =&gt; 0
                                    [p] =&gt; base
                                    [v] =&gt; impsearchvinbox
                                )

                        )

Namely, there is no INBOX value.  There HAS to be an INBOX value, and our code explicitly creates one if it doesn&#039;t exist.

Although looking at the code... if an exception is thrown from the Imap server, INBOX won&#039;t be added.  That shouldn&#039;t be that way - we need to fatal out if the IMAP server can&#039;t do a basic thing like listing mailboxes.  You can try applying this patch and see if you get an IMAP error now.</description> 
   <pubDate>Thu, 01 Mar 2012 00:31:28 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70553</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git (develop):

commit 0f8e19b5982</title> 
   <description>Changes have been made in Git (develop):

commit 0f8e19b5982e5d078195800a4e7af78b8956f893
Author: Michael M Slusarz &lt;slusarz@horde.org&gt;
Date:   Wed Feb 29 16:49:05 2012 -0700

    Bug #11041: If mailbox listing fails, this needs to be a fatal error since the IMAP tree cannot be built correctly.

 imp/lib/Imap/Tree.php |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

http://git.horde.org/horde-git/-/commit/0f8e19b5982e5d078195800a4e7af78b8956f893</description> 
   <pubDate>Thu, 01 Mar 2012 08:35:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70561</link> 
  </item> 
   
  <item> 
   <title>Thank you very much for your fast response. Will try the pat</title> 
   <description>Thank you very much for your fast response. Will try the patch and report back</description> 
   <pubDate>Fri, 02 Mar 2012 08:30:36 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70568</link> 
  </item> 
   
  <item> 
   <title>Looking good so far, will provide final feedback next week</title> 
   <description>Looking good so far, will provide final feedback next week</description> 
   <pubDate>Fri, 02 Mar 2012 12:08:19 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70569</link> 
  </item> 
   
  <item> 
   <title>The issue is resolved. We did not see any bad side effects f</title> 
   <description>The issue is resolved. We did not see any bad side effects for the fix -&gt; simply works.

Thank you.</description> 
   <pubDate>Mon, 05 Mar 2012 08:58:17 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11041#t70586</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
