Author Topic: Apache getting in an infinite loop when using Roundcube....  (Read 4959 times)

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Hello everybody!

Some time ago I tried Roundcube (0.1-beta) but faced this same exact problem... I was in a hurry so I just went over to Ilohamail, now a few months have passed and decided to give Roundcube another try (now with the SVN version) since I find it very nice.

Apache 2.0.55
FreeBSD 6.0
MySQL 5.0.18
dbmail 2.0.7

Everything works ok by itself, so in general I doubt there's any problem with the configuration of those.

The problem is the following. Roundcube seems to work ok (actually it does) but most of the times when an user logs in and retrive the listing of his messages leaves the corresponding http process in an infinite loop that takes 100% CPU time. Roundcube keeps working ok but at every request every new httpd child that answer the request start looping as well until, when 6/7 copies of httpd allocate all the processor time, apache stops responding or respond very slowly.

After a couple of minutes (when the PHP's script timeout kicks in, I suppose) the httpd children start to close and everything gets back to normal again.

To me it looks like an infinite loop somewhere in roundcube code. I tried to track down where the problem may be but could not find any clue.

Here are my hints:

1) the problems kicks in when logging in, but after all the processing has been done, since the output to the client looks perfect: there even is the and at the end of the page, so all the output stuff should be closed
2) the connection to the IMAP server gets closed without any problem at the correct time... read: connection established, data fetched, connection closed
3) after the initial page, if i click on any subfolder from the main one, the "Loading..." box appears, but nothing happens. the connection to the IMAP server is opened but never closed (until it times out after about 30 seconds). httpd goes to 100% again, no output to the client ad all

Now i'll try to find some IMAP server somewhere to try to use my webmail to log in to a remote server and see if the problem still kicks in...

in the meantime, do you have any suggestion?


Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #1 on: July 03, 2006, 11:17:56 AM »
I tried with a different IMAP server (I mean, on another machine), the same things happens. :'( :'( :'(

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #2 on: July 03, 2006, 11:21:59 AM »
Ok, I tried with another more server, this time from a public provider (tiscali) and everything worked ok, so we can restrict the problem to the interaction betwenn Roundcube and dbmail (as both the server I tried first are using dbmail).

how do we solve the thing? :-)

I suppose roundcube is expecting some special kind word at the end of the session and dbmail is not saying it so it crashes...

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #3 on: July 03, 2006, 11:23:28 AM »
Is there a way to disable the free/used mailbox space check?

Offline flosoft

  • Sr. Member
  • ****
  • Posts: 349
    • http://flosoft.biz
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #4 on: July 03, 2006, 11:31:03 AM »
Skeyby: Not that I know of.

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #5 on: July 03, 2006, 11:32:15 AM »
No, the problem it's not the quota.

Anyhow I tought about looking at roundcubemail/logs/errors and found this:


[03-Jul-2006 16:54:58] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/share/roundcubemail/program/lib/imap.inc on line 128
[03-Jul-2006 17:08:32] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/share/roundcubemail/program/lib/imap.inc on line 128
[03-Jul-2006 17:11:12] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/share/roundcubemail/program/lib/imap.inc on line 128
[03-Jul-2006 17:18:31] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/share/roundcubemail/program/lib/imap.inc on line 129


Line 128/129 of imap.inc is:


function iil_ReadLine($fp, $size){
    $line="";
    if ($fp){
        do{
           $buffer = fgets($fp, 2048);
            $line.=$buffer;

        }while($buffer[strlen($buffer)-1]!="\n");
    }
    return $line;
}


I'm investigating further...

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #6 on: July 03, 2006, 11:45:41 AM »
YEEEEEEAH! :D :D :D

I found the problem ;)

function iil_C_CountUnseen(&$conn, $folder){
/*   $index = iil_C_Search($conn, $folder, "ALL UNSEEN");
    if (is_array($index)){
        $str = implode(",", $index);
        if (empty($str)) return false;
        else return count($index);
    }else return false; */
    return false;
}


I suppose there's something broken in dbmail SEARCH ALL UNSEEN implementation (i'm going to ask them about this). Commenting out the iil_C_CountUnseend function made everything work like a clock.

Now the fancy thing is that imap.inc is from IlohaMail and IlohaMail is working OK on my system... I'll go to counter-check how it's working there.

Anyhow it's really not good to roundcube to panic if the server doesn't behave as expected!!!

Any more hint?

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #7 on: July 03, 2006, 11:48:46 AM »
Ok, I've seen that IlohaMail's function iil_C_Unseen is a bit different from roundcube.

I'm trying a surgical transplant :-)

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #8 on: July 03, 2006, 11:55:48 AM »

No, sorry I mistakenly read the function names iil_C_CountUnseen is the same between ilohamail and roundcube... iil_C_Unseen is different but it has nothing in relation to this...

Offline simoesp

  • Jr. Member
  • **
  • Posts: 46
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #9 on: July 05, 2006, 01:10:19 PM »
maybie it's the php version that you have :P i've goted a problem a while ago... and it waht becasue of the php that had a bug
--------------------------------------------------------
 **                       S.I.M.O.E.S.P.                       **
--------------------------------------------------------

Offline skeyby

  • Jr. Member
  • **
  • Posts: 10
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #10 on: July 12, 2006, 05:42:51 AM »
Quote from: simoesp
maybie it's the php version that you have :P i've goted a problem a while ago... and it waht becasue of the php that had a bug

No, it happens with different versions of PHP.

It is because of an implemented IMAP command in dbmail. SEARCH ALL UNSEEN seems to be responsible.

oslad

  • Guest
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #11 on: July 12, 2006, 09:49:05 PM »
Maybe a symbol link problem!
All PHP application shouldn't using symbol link.
say that, your roundcube is placed to folder "/var/www/html/roundcube"
if "roundcube" or "html" or any part is this full path is a symbol link to another actual folder, this case will occur.

Offline chiefy

  • Newbie
  • *
  • Posts: 1
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #12 on: July 26, 2006, 10:22:47 AM »
I am having the same problem
Code: [Select]
PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/cpanel/base/roundcube/program/lib/imap.inc on line 130
PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/cpanel/base/roundcube/program/lib/imap.inc on line 128

Running: Apache 1.3.36 PHP 5.1.4 w/ Zend Optimizer v. 3.0.0 / cPanel / Exim / MySQL 4.1

Eating about 60-80% cpu

Offline cashmere

  • Newbie
  • *
  • Posts: 2
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #13 on: January 07, 2007, 11:31:54 AM »
Does anyone have a solution for this problem? I'm running beta 1.2 and I still have this problem...
Tnx!

Offline jpingle

  • Jr. Member
  • **
  • Posts: 77
Re: Apache getting in an infinite loop when using Roundcube....
« Reply #14 on: January 07, 2007, 12:08:15 PM »
There is an open ticket for this with some things you might find useful:

http://trac.roundcube.net/trac.cgi/ticket/1483956