Summary | PHP process hangs drawing 100% CPU until killed |
Queue | IMP |
Queue Version | 5.0.18 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | slusarz (at) horde (dot) org |
Requester | pop3 (at) flachtaucher (dot) de |
Created | 02/29/2012 (4877 days ago) |
Due | |
Updated | 03/05/2012 (4872 days ago) |
Assigned | 02/29/2012 (4877 days ago) |
Resolved | 03/05/2012 (4872 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
-> simply works.
Thank you.
commit 0f8e19b5982e5d078195800a4e7af78b8956f893
Author: Michael M Slusarz <slusarz@horde.org>
Date: Wed Feb 29 16:49:05 2012 -0700
Bug #11041: If mailbox listing fails, this needs to be a fatalerror 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
[_tree:protected] => Array
(
[base] => Array
(
[a] => 0
[v] => base
)
[vfolder] => Array
(
[a] => 385
[c] => 0
[p] => base
[v] => vfolder
)
[impsearchvinbox] => Array
(
[a] => 136
[c] => 0
[p] => base
[v] => impsearchvinbox
)
)
Namely, there is no INBOX value. There HAS to be an INBOX value, and
our code explicitly creates one if it doesn't exist.
Although looking at the code... if an exception is thrown from the
Imap server, INBOX won't be added. That shouldn't be that way - we
need to fatal out if the IMAP server can't do a basic thing like
listing mailboxes. You can try applying this patch and see if you get
an IMAP error now.
commit 0f8e19b5982e5d078195800a4e7af78b8956f893
Author: Michael M Slusarz <slusarz@horde.org>
Date: Wed Feb 29 16:49:05 2012 -0700
Bug #11041: If mailbox listing fails, this needs to be a fatalerror 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
State ⇒ Assigned
New Attachment: diagnose_output.txt
State ⇒ Unconfirmed
New Attachment: diagnose_patch.diff
Patch ⇒ No
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ PHP process hangs drawing 100% CPU until killed
Type ⇒ Bug
Priority ⇒ 2. Medium
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 > 10 times per day on a busy System
serving >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
("diagnose_patch.diff")
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
"daignose_output.txt".
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