6.0.0-alpha12
6/6/25

[#10252] Infinite loop breaks apache
Summary Infinite loop breaks apache
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester mmarx (at) netdmon (dot) de
Created 06/16/2011 (5104 days ago)
Due
Updated 06/28/2011 (5092 days ago)
Assigned 06/25/2011 (5095 days ago)
Resolved 06/28/2011 (5092 days ago)
Milestone
Patch No

History
06/28/2011 10:20:14 AM Jan Schneider Assigned to Jan Schneider
Taken from Michael Slusarz
State ⇒ Resolved
 
06/28/2011 10:15:46 AM Git Commit Comment #13 Reply to this comment
Changes have been made in Git for this ticket:

Implement Serializable interface to fix serialization, this time for 
real (Bug #10252).

  3 files changed, 86 insertions(+), 28 deletions(-)
http://git.horde.org/horde-git/-/commit/81986ac9689647052cfd2ed8637d0e8cc29f9371
06/26/2011 07:17:48 PM thom (at) xsbyte (dot) com Comment #12 Reply to this comment
Changes have been made in Git for this ticket:

Check if file pointer is (still) a valid resource (Bug #10252).

  1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/12e98ec4c91378ae7faa64a97630dc6afab8102b
--

This fixed the problem on our production server. It made an inifite loop.
Happy to have it working again.

Thanks!
06/25/2011 08:50:42 PM Jan Schneider Assigned to Michael Slusarz
State ⇒ Assigned
 
06/25/2011 08:50:17 PM Jan Schneider Comment #11
Version ⇒ Git master
Queue ⇒ Horde Framework Packages
Reply to this comment
Bug in Horde_Mime.
06/25/2011 08:47:58 PM Git Commit Comment #10 Reply to this comment
Changes have been made in Git for this ticket:

Revert "Always make sure that $_contents is a resource before using it 
(Bug #10252)."
This reverts commit b2d086839532ea785a20e7bd1a57d114e6cd2658.

This breaks message viewing in IMP, though all tests pass just fine. No
idea what IMP is doing with mime parts that breaks this.

  2 files changed, 9 insertions(+), 31 deletions(-)
http://git.horde.org/horde-git/-/commit/10b3eb5f8f5f5baa2e9490b7d69316dfa38024f7
06/25/2011 07:53:00 PM Git Commit Comment #9 Reply to this comment
Changes have been made in Git for this ticket:

Always make sure that $_contents is a resource before using it (Bug #10252).
As a side-effect of serializing, it might have been converted to a string, and
we don't want to clone the mime part before serializing it.

  2 files changed, 31 insertions(+), 9 deletions(-)
http://git.horde.org/horde-git/-/commit/b2d086839532ea785a20e7bd1a57d114e6cd2658
06/25/2011 07:52:59 PM Git Commit Comment #8 Reply to this comment
Changes have been made in Git for this ticket:

Add test case for bug #10252.

  1 files changed, 5 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/0dd9cbe7aa097bdf5120bb3417f3e99ba057a343
06/25/2011 07:52:58 PM Git Commit Comment #7 Reply to this comment
Changes have been made in Git for this ticket:

Check if file pointer is (still) a valid resource (Bug #10252).

  1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/12e98ec4c91378ae7faa64a97630dc6afab8102b
06/25/2011 01:11:56 PM mmarx (at) netdmon (dot) de Comment #6
New Attachment: kronolith_failing_conf.php Download
Reply to this comment
I can still recreate the issue with the steps I described below.

Please tell me what I can do to help you debug the problem.

As a first step I attached the kronolith config of my horde installation.
06/24/2011 06:55:27 PM Michael Rubinsky Comment #5
State ⇒ Feedback
Priority ⇒ 1. Low
Version ⇒ Git master
Reply to this comment
I cannot reproduce this. When I perform the listed steps to reproduce, 
after saving the event, I get an alarm notification displayed for this 
event.
06/21/2011 05:21:58 PM Michael Slusarz Version ⇒
Queue ⇒ Kronolith
 
06/17/2011 08:21:31 AM mmarx (at) netdmon (dot) de Comment #4 Reply to this comment
I investigated a little bit further because my system got unusable again.

Steps to recreate the issue:

1. Open the calendar
2. Create an event for the current date with the following settings
    Title: testevent
    From: 1 hour later than the current time
    Length: 1 hour
    Reminder: Set to 2 hours before the event (This time lies in the past)
3. Leave the remaining settings as defaults
4. As soon as you click "Save" something breaks

So I think this bug is not IMP but Kronolith/Notification related.

I could get my system running again after I deleted the corresponding 
entry in the "horde_alarms" database table and after I changed the 
entry created for this event in the "kronolith_events" database table 
so that the "event_alarm" is in the future.
06/16/2011 03:36:44 PM mmarx (at) netdmon (dot) de Comment #3 Reply to this comment
But ... I could reproduce the issue. I just moved an appointment in 
the montly view in kronolith from one day to the next and tried to 
switch to DIMP. The CPU load for the apache process immediatly rose to 
100% and the logfiles got spammed again with the "fread" and "feof" 
messages but this time kronolith produced them.

Jun 16 17:27:26 server HORDE: HORDE [kronolith] PHP ERROR: Undefined 
index: api [pid 13557 on line 1216 of 
"/usr/share/horde4/kronolith/lib/Kronolith.php"]
Jun 16 17:27:26 server HORDE: HORDE [kronolith] PHP ERROR: Undefined 
index: api [pid 13557 on line 1219 of 
"/usr/share/horde4/kronolith/lib/Kronolith.php"]
Jun 16 17:27:26 server HORDE: HORDE [kronolith] PHP ERROR: Undefined 
index: api [pid 13557 on line 1222 of 
"/usr/share/horde4/kronolith/lib/Kronolith.php"]
Jun 16 17:27:26 server HORDE: HORDE [kronolith] PHP ERROR: Undefined 
index: api [pid 13557 on line 1231 of 
"/usr/share/horde4/kronolith/lib/Kronolith.php"]
Jun 16 17:27:36 server HORDE: HORDE [kronolith] PHP ERROR: rewind() 
expects parameter 1 to be resource, string given [pid 13557 on line 
1802 of "/usr/share/php/Horde/Mime/Part.php"]
Jun 16 17:27:36 server HORDE: HORDE [kronolith] PHP ERROR: feof() 
expects parameter 1 to be resource, string given [pid 13557 on line 
1803 of "/usr/share/php/Horde/Mime/Part.php"]
Jun 16 17:27:36 server HORDE: HORDE [kronolith] PHP ERROR: fread() 
expects parameter 1 to be resource, string given [pid 13557 on line 
1804 of "/usr/share/php/Horde/Mime/Part.php"]
Jun 16 17:27:36 server HORDE: HORDE [kronolith] PHP ERROR: feof() 
expects parameter 1 to be resource, string given [pid 13557 on line 
1803 of "/usr/share/php/Horde/Mime/Part.php"]
...

06/16/2011 03:27:07 PM mmarx (at) netdmon (dot) de Comment #2 Reply to this comment
I can maybe qualify the severity because the problem disappeared. I 
checked again after some hours if the webinterface would still crash 
but it did not. The system now behaves again as it should.
06/16/2011 09:38:00 AM mmarx (at) netdmon (dot) de Comment #1
Priority ⇒ 3. High
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ Infinite loop breaks apache
Type ⇒ Bug
Queue ⇒ IMP
Reply to this comment
I've just came across a severe bug in IMP which locks up my apache 2 
process with 100% CPU load. I'm not exactly sure what I did to cause 
it but I will describe my actions as good as I can.

I setup horde4 with imp, kronolith, turba etc. it worked like a charm 
for some weeks now. I regularly update the pear packages when I get 
the announcements.

Today I used kronolith to create a new calendar entry in April 2012, 
shortly after this I moved an appointment from today to tomorrow via 
drag and drop. Then I tried to switch back to DIMP. It kept saying 
"Loading" but nothing happened. I logged into my server and realized 
that the apache2 process was running at 100% CPU load. I checked the 
logfiles and saw that my /var/log/messages file grew rapidly. See 
below, the "fread" and "feof" error lines spammed the logfile. I 
restarted the apache server, removed /tmp/<horde cache files>*, 
restarted my browser and logged in again to the horde webinterface. 
The snippet below from the /var/log/messages file is the result of 
this successful login process but the result is the same, the logfile 
gets spammed with the PHP error messages.

Since then I can no longer use the horde webinterface because as soon 
as I access it, it instantly locks up my apache server.

System information:
-------------
root@server:~# pear list -c horde
INSTALLED PACKAGES, CHANNEL PEAR.HORDE.ORG:
===========================================
PACKAGE                   VERSION STATE
...
horde                     4.0.6   stable
imp                       5.0.7   stable
kronolith                 3.0.4   stable
...
-------------
root@server:~# pear list-upgrades
Channel pear.horde.org: No upgrades available
-------------
root@server:~# php -v
PHP 5.3.3-7+squeeze1 with Suhosin-Patch (cli) (built: Mar 18 2011 17:22:52)
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
     with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

Logfiles:
/var/log/messages:
Jun 16 10:53:41 server HORDE: HORDE [horde] Login success for a@b.de 
[111.111.222.222] to horde. [pid 25835 on line 153 of 
"/usr/share/horde4/login.php"]
Jun 16 10:53:41 server HORDE: HORDE [imp] Login success for a@b.de 
(Horde user a@b.de) [111.111.222.222] to {localhost:993 [imap]} [pid 
25835 on line 179 of "/usr/share/horde4/imp/lib/Auth.php"]
Jun 16 10:53:44 server HORDE: HORDE [imp] PHP ERROR: rewind() expects 
parameter 1 to be resource, string given [pid 25835 on line 1802 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:53:44 server HORDE: HORDE [imp] PHP ERROR: feof() expects 
parameter 1 to be resource, string given [pid 25835 on line 1803 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:53:44 server HORDE: HORDE [imp] PHP ERROR: fread() expects 
parameter 1 to be resource, string given [pid 25835 on line 1804 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:53:44 server HORDE: HORDE [imp] PHP ERROR: feof() expects 
parameter 1 to be resource, string given [pid 25835 on line 1803 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:53:44 server HORDE: HORDE [imp] PHP ERROR: fread() expects 
parameter 1 to be resource, string given [pid 25835 on line 1804 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:53:44 server HORDE: HORDE [imp] PHP ERROR: feof() expects 
parameter 1 to be resource, string given [pid 25835 on line 1803 of 
"/usr/share/php/Horde/Mime/Part.php"]
...
-------------
/var/log/syslog:
...
Jun 16 10:54:01 server HORDE: HORDE [imp] PHP ERROR: fread() expects 
parameter 1 to be resource, string given [pid 25835 on line 1804 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:54:01 server HORDE: HORDE [imp] PHP ERROR: feof() expects 
parameter 1 to be resource, string given [pid 25835 on line 1803 of 
"/usr/share/php/Horde/Mime/Part.php"]
Jun 16 10:54:01 server suhosin[16086]: ALERT - canary mismatch on 
efree() - heap overflow detected at 0xba12588c (attacker 'REMOTE_ADDR 
not set', file '/usr/share/horde4/imp/lib/Ajax/Application.php', line 
456)
-------------

Please tell me if you need further information.

Saved Queries