Edit report at https://pear.php.net/bugs/bug.php?id=16975&edit=1

ID: 16975
Updated by: mike@silverorange.com
Reported By: gary at rrripple dot com
Summary: Slow memory leak
Status: Open
Type: Bug
Package: Services_Amazon_SQS
Operating System: Ubuntu
Package Version: 0.3.0
PHP Version: 5.2.5
Roadmap Versions:
New Comment:

Is this still an issue with newer versions of PHP that include garbage

I don't think it is an issue with this package specifically.

Previous Comments:

[2010-01-06 19:13:40] glub

Agreed, if only 10 bytes every 10 seconds it wouldn't be growing to
35MB, so somewhere in the 12 hours it's jumping more. In this test, the
queue is empty. I'm just polling it for messages (which are usually very
small, around a few bytes). For the test, you can leave the queue empty
and watch the memory grow after each receive. I'm also seeing this in


[2010-01-06 19:08:54] gauthierm

Thanks for the bug report. I have a couple of questions to help me test
and debug

1. Is the queue actually full, are you receiving a message for each

1. What size are the messages in the queue?

In 12 hours, the script would make 4320 calls. If the script is leaking
10 bytes a
call, that would mean 42.2 KB in 12 hours. The majority of the 35 MB of
memory is
likely allocated on startup.

Before the 0.3.0 release, I tested SQS running in a loop receiving
50,000 messages.
While there was some leakage, the amount did not grow dangerously over
lifetime of the script.


[2010-01-06 17:28:53] glub

I've written a PHP daemon in which a call is made to $queue->retrieve
every 10 seconds. I'm seeing the memory usage increase by around 10
bytes after every call. After 12 hours of running the memory usage is
around 35 MB.

Test script:
require_once 'Services/Amazon/SQS/Exceptions.php';
require_once 'Services/Amazon/SQS/Queue.php';

$access_key = "<access key>";
$secret_access_key = "<secret key>";
$queue_url = 'http://queue.amazonaws.com/<id>';

while ( true ) {
$queue = new Services_Amazon_SQS_Queue( $queue_url, $access_key,
$secret_access_key );
$messages = $queue->receive( 1, 7200 );
if ( count ($messages) <= 0 ) {
echo "no messages\n";
unset( $queue );
sleep( 10 );

Expected result:
No memory leaks.


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedDec 31, '11 at 3:32a
activeDec 31, '11 at 3:32a

1 user in discussion

Mike: 1 post



site design / logo © 2022 Grokbase