zhangzhiwei1228 / xmpphp

Automatically exported from code.google.com/p/xmpphp
0 stars 0 forks source link

Possible memory leak? #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Thank you for providing this great tool for the open source community. 

I've been developing a XMPP based bot that listens on our group's
conversation inside our chat conference room where one of us can send
commands to this bot by typing "gocbot: count" (which will display current
statistics)

There is a while loop inside my php script that calls following function
repeatedly.

$events = $conn->processUntil('message', 30);

and if there is a message, it parses it and see if it's a command given to
the bot or not.. 

This works great, but after about 12 hours of continuous run, it eventually
displays following error message.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 71 bytes) in
/home/hayashis/dev/monitor/gocbot/XMPPHP/XMLStream.php on line 649

and bot hoses up (the process is still running but it doesn't process XMPP
messages anymore).

Can you help!?

Thanks,
Soichi

Original issue reported on code.google.com by soichih on 20 May 2010 at 1:33

GoogleCodeExporter commented 8 years ago
I've come up with a possible solution..

In XMPPHP/XMLStream.php :: Line 654

//remove old event if array is full (let's store upto 100 payloads)
if($this->until_count[$key] > 100) {
    array_shift($this->until_payload);
} else {
    $this->until_count[$key] += 1;
}

I don't know if this works, or if it causes any side effect.. I will see.

Original comment by soichih on 5 Aug 2010 at 4:45

GoogleCodeExporter commented 8 years ago
hey, soichih..how is app doing? is it facing any more issues.

Original comment by sayo...@gmail.com on 26 Sep 2011 at 10:36

GoogleCodeExporter commented 8 years ago
Yes, I am still having this issue. My "possible solution" didn't work. I have a 
cron job set up to automatically restart my service when xmpphp service dies. I 
haven't updated the xmpphp library since then.. I am not sure if this issue has 
already being fixed.

Original comment by soichih on 26 Sep 2011 at 2:30