[#3019] imp goes into an infinite loop for a couple of accounts (in Folder.php)
Summary imp goes into an infinite loop for a couple of accounts (in Folder.php)
Queue IMP
Queue Version HEAD
Type Bug
State Resolved
Priority 2. Medium
Owners
Requester seker (at) uwyo (dot) edu
Created 11/22/2005 (1143 days ago)
Due
Updated 11/29/2005 (1136 days ago)
Assigned 11/22/2005 (1143 days ago)
Resolved 11/29/2005 (1136 days ago)
Attachments
Milestone
Patch No

History
11/29/2005 Michael Slusarz Comment #20
State ⇒ Resolved
Reply to this comment
Users will always find a way around what you are preventing them from 
using no matter what :)

Closing this ticket.
11/29/2005 seker (at) uwyo (dot) edu Comment #19 Reply to this comment
I lied, each of the three had a .mh_profile in their account.  Still 
not sure how two of the accounts used mh, since I don't have it 
installed... but the file was there.

11/29/2005 seker (at) uwyo (dot) edu Comment #18 Reply to this comment
The one I tested with did, a very long time ago (it was deinstalled 3+ 
years ago), he still uses Rmail mail now and again.
The other two are accounts created within the last year, so they 
should not have been able to used it.  They use pine and imp to read 
there mail.
11/29/2005 Michael Slusarz Comment #17 Reply to this comment
Just curious - did any of those 3 users use mh?
11/29/2005 seker (at) uwyo (dot) edu Comment #16 Reply to this comment
It now works for the user I've been testing with, I'm waiting on word 
from the other 2, but I think it is fixed for all of them.

Thanks!

11/29/2005 Michael Slusarz Comment #15 Reply to this comment
11/29/2005 Michael Slusarz Comment #14 Reply to this comment
11/29/2005 seker (at) uwyo (dot) edu Comment #13 Reply to this comment
still doesn't work.  slightly Different error messages now:

[client ipaddr] PHP Warning:  explode(): Empty delimiter. in 
/var/www/html/horde/imp/lib/Folder.php on line 168, referer: 
https://webmail/horde/services/portal/sidebar.php

[client ipaddr ] PHP Warning:  array_pop(): The argument should be an 
array in /var/www/html/horde/imp/lib/Folder.php on line 169, referer
: https://webmail/horde/services/portal/sidebar.php

Repeat starts here:
[client ipaddr] PHP Warning:  implode(): Bad arguments. in 
/var/www/html/horde/imp/lib/Folder.php on line 174, referer: 
https://webmail/horde/services/portal/sidebar.php

[client ipaddr] PHP Warning:  array_pop(): The argument should be an 
array in /var/www/html/horde/imp/lib/Folder.php on line 186, referer
: https://webmail/horde/services/portal/sidebar.php
and repeat...

making sure the line number matchup, heres the code, starting at 168 
through 187

168                    $parts = explode($mailbox['d'], $label);
169                    $subfolder = array_pop($parts);
170                    $parentparts = $parts;
171                    $pstack = array();
172
173                   while ($i = count($parentparts)) {
174                        $parent = implode($mailbox['d'], $parentparts);
175                        if (!empty($parent) &&
176                            !isset($seen[$parent])) {
177                            $seen[$parent] = true;
178                            $plabel = str_repeat(' ', 4 * ($i - 1)) 
. String::convertCharset($parts[($i - 1)], 'UTF7-IMAP');
179                           if (strlen($plabel) > 26) {
180                                $pabbrev = String::substr($plabel, 
0, 10) . '...' . String::substr($plabel, -13, 13);
181                            } else {
182                                $pabbrev = $plabel;
183                            }
184                            $pstack[$parent] = array('val' => '', 
'label' => $plabel, 'abbrev' => $pabbrev);
185                        }
186                        array_pop($parentparts);
187                  }
11/29/2005 Michael Slusarz Comment #12 Reply to this comment
11/29/2005 seker (at) uwyo (dot) edu Comment #11 Reply to this comment
This was displayed via the web browser:
Array ( [name] => [delimiter] => / [type] => personal ) Array ( [name] 
=> #mhinbox [delimiter] => [type] => personal ) Array ( [name] => #mh/ 
[delimiter] => / [type] => personal ) Array ( [name] => #shared/ 
[delimiter] => / [type] => shared ) Array ( [name] => #public/ 
[delimiter] => / [type] => shared )

The logs in the error log were the same.
11/29/2005 Michael Slusarz Comment #10 Reply to this comment
Please put in some kind of logging statement like:
print_r($ns_info);
on line 121 of Folder.php and post the output.
11/28/2005 seker (at) uwyo (dot) edu Comment #9 Reply to this comment
So here are the error messages from the beginning of the user's login:

[client ipaddr ] PHP Notice:  Uninitialized string offset:  0 in 
/var/www/html/horde/imp/lib/Folder.php on line 168, referer: 
https://webmail/horde/services/portal/sidebar.php

[client ipaddr] PHP Warning:  explode(): Empty delimiter. in 
/var/www/html/horde/imp/lib/Folder.php on line 168, referer: 
https://webmail/horde/services/portal/sidebar.php

[client ipaddr] PHP Warning:  array_pop(): The argument should be an array
in /var/www/html/horde/imp/lib/Folder.php on line 169, referer: 
https://webmail/horde/services/portal/sidebar.php

REPEAT lines start here:
[client ipaddr] PHP Notice:  Uninitialized string offset:  0 in 
/var/www/html/horde/imp/lib/Folder.php on line 174, referer: 
https://webmail/horde/services/portal/sidebar.php

[client ipaddr] PHP Warning:  implode(): Bad arguments. in 
/var/www/html/horde/imp/lib/Folder.php on line 174, referer: 
https://webmail/horde/services/portal/sidebar.php

[client ipaddr] PHP Warning:  array_pop(): The argument should be an array
in /var/www/html/horde/imp/lib/Folder.php on line 186, referer: 
https://webmail/horde/services/portal/sidebar.php

AND repeat until timeout or machine crashes, which ever comes first.

[client ipaddr ] PHP Fatal error:  Maximum execution time of 30 
seconds exceeded in /var/www/html/horde/imp/lib/Folder.php on line 
174, referer: https://webmail/horde/services/portal/sidebar.php


horde.log entry, 1 line
Nov 28 14:04:54 HORDE [notice] [imp] Login success for USER [ip addr] 
to {localhost:143} [on line 152 of 
"/var/www/html/horde/imp/redirect.php"]

11/24/2005 seker (at) uwyo (dot) edu Comment #8 Reply to this comment
hordeauth is false, from servers.php:
$servers['cosc'] = array(
     'name' => 'Cosc Server',
     'server' => 'localhost',
     'hordeauth' => false,
     'protocol' => 'imap/notls',
     'port' => 143,
     'maildomain' => 'uwyo.edu',
     'smtphost' => 'fred',
     'smtpport' => 25,
     'realm' => 'uwyo.edu',
     'preferred' => '',
     'dotfiles' => false,
);

authenication in horde is through imp.
11/24/2005 Michael Slusarz Comment #7 Reply to this comment

[Hide Quoted Text]
We have about 2 dozen people using  horde/imp regularly and 3 accounts
cause Folder.php to go into an infinite loop, generating tons of log
messages from php to the error log (see below) and php never stops, the
web server has be stopped and restarted.   This loop only happens in
imp, they can use horde, other modules are load up just fine.   All the rest
of the people can use the system including imp without problems.

For the failing accounts, They login correctly, the horde main page
loads.  When
they click on mail, then it goes into the infinite loop.
Are you using 'hordeauth => true'?  If so, are you sure these user's 
horde passwords are the same as their imp passwords?  that's still the 
only thing I can think of that would cause those parameters to be 
undefined.
11/22/2005 seker (at) uwyo (dot) edu Comment #6 Reply to this comment
Before I "turned down" the error loging, the errors just kept 
repeating the 3 I listed, until it filled my filesystem with the logs 
were kept.  I didn't see any other messages, except message saying 
they had logged in.

I can turn the loggin back to E_All and see if there are any more, but 
since it don't happen in my account, I won't be see the messages until 
after thanksgiving.
11/22/2005 Michael Slusarz Comment #5 Reply to this comment
Looking at the code, this doesn't make any sense to me. Are these the
only warnings/error messages? There should be some before already.
Agreed - this is why I can't figure this out either.  Especially in 
HEAD, since if namespace and/or the delimiter was not set correctly 
IMAP_Client:: would have thrown all sorts of errors on login.  So the 
only thing I can think is somehow IMP code is being called before the 
user has ever logged into IMP, and the session variables are not yet 
set.
11/22/2005 Jan Schneider Comment #4
Priority ⇒ 2. Medium
State ⇒ Feedback
Reply to this comment
Looking at the code, this doesn't make any sense to me. Are these the 
only warnings/error messages? There should be some before already.
11/22/2005 horde (at) tyldum (dot) com Comment #3 Reply to this comment

[Hide Quoted Text]
Just wanted to add a 'me too'. I'm testing a new Horde deployment
here and suddenly this behaviour started. I was experimenting with
custom hooks at the time, but disabling them, deleting them and
emptying the horde_prefs has no effect.

Met this problem before too once. Sadly it then ran until it had
filled 200GiB of diskspace with error logging :)
A reboot saved it then, but not this time.

Linux, apache 2.0.55, courier 4.0.6, php 5.0.5.
And most importantly: Horde 3.0.7 AND 3.0.6, IMP 4.0.4.
11/22/2005 horde (at) tyldum (dot) com Comment #2 Reply to this comment
Just wanted to add a 'me too'. I'm testing a new Horde deployment here 
and suddenly this behaviour started. I was experimenting with custom 
hooks at the time, but disabling them, deleting them and emptying the 
horde_prefs has no effect.

Met this problem before too once. Sadly it then ran until it had 
filled 200GiB of diskspace with error logging :)
A reboot saved it then, but not this time.

Linux, apache 2.0.55, courier 4.0.6, php 5.0.5.
11/22/2005 seker (at) uwyo (dot) edu Comment #1
State ⇒ Unconfirmed
Summary ⇒ imp goes into an infinite loop for a couple of accounts (in Folder.php)
Type ⇒ Bug
Priority ⇒ 3. High
Queue ⇒ IMP
Reply to this comment
We have about 2 dozen people using  horde/imp regularly and 3 accounts
cause Folder.php to go into an infinite loop, generating tons of log
messages from php to the error log (see below) and php never stops, the
web server has be stopped and restarted.   This loop only happens in
imp, they can use horde, other modules are load up just fine.   All the rest
of the people can use the system including imp without problems.

For the failing accounts, They login correctly, the horde main page 
loads.  When
they click on mail, then it goes into the infinite loop.  It will also
happens, when the click on personal information in mail options, I
haven't had them try any of the other options in mail.

I've created a new user account and loged it into horde/imp and it
worked without problems.  I deleted all the entries (I think anyway)
from the database on one of the failing accounts and had the user login
again and it still did the same thing.

message, repeated until fills up the file space for the logs :
[client ip addr] PHP Warning:  implode(): Bad arguments. in
/var/www/html/horde/imp/lib/Folder.php on line 174, referer:
https://webmail/horde/services/portal/sidebar.php
[client ip addr] PHP Warning:  array_pop(): The argument should be an
array in /var/www/html/horde/imp/lib/Folder.php on line 186, referer:
https://webmail/horde/services/portal/sidebar.php
[client ip addr] PHP Notice:  Uninitialized string offset:  0 in
/var/www/html/horde/imp/lib/Folder.php on line 174, referer:
https://webmail/horde/services/portal/sidebar.php

The lines listed by the errors are:
173:  while ($i = count($parentparts)) {
174:  $parent = implode($mailbox['d']['delimiter'], $parentparts);
186:  array_pop($parentparts);
So my guess is that the $parentparts array doesn't have correct values
and the while loop doesn't end when parentparts is empty, but it's not
empty due to the error at 174 and/or 186.

As a stop gap, I changed to horde configs:  max_execution_time to 30
and error_reporting to E_ERROR, so everyone else can use the system.

configs info:
Redhat E4, php-4.3.9-3.9, mysql-4.1.12-3.RHEL4.1
cvs head (today 11/22/05), using mysql drivers, no mailbox caching
Horde: 3.2-cvs Imp: H3 (4.2-cvs) Ingo: H3 (1.2-cvs) Jeta: 0.1-cvs
Kronolith: H3 (2.2-cvs) Mnemo: H3 (2.2-cvs) Nag: H3 (2.2-cvs) Turba: H3
(2.2-cvs)