#47328 [Opn->Bgs]: shmop_open memory leak cause apache crash

From: Date: Sun, 08 Feb 2009 15:59:08 +0000
Subject: #47328 [Opn->Bgs]: shmop_open memory leak cause apache crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133607@lists.php.net to get a copy of this message
 ID:               47328
 Updated by:       iliaa@php.net
 Reported By:      hszheng at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Semaphore related
 Operating System: win32
 PHP Version:      5.2.9RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

The system only allows so many shm segments, if you saturate the queue

with the ones from PHP, apache will not be able to create internal 
segments and will abort.


Previous Comments:
------------------------------------------------------------------------

[2009-02-06 10:26:20] hszheng at gmail dot com

Description:
------------
php version 5.2.6
Build Date 	May 2 2008 18:01:20 
PHP API 	20041225
PHP Extension 	20060613
Zend Extension 	220060519

Apache/2.2.8 (Win32) PHP/5.2.6 
Apache API Version 	20051115 

Request URL http://host/file1.php
Request URL http://host/file2.php and refresh several times.
windows alert that httpd.exe - application error. notice a memory
address can not be "read".

In Task manager during the operation, the process httpd.exe memory
usage increment quickly, and then crashed.


Reproduce code:
---------------
file1.php
--------------------------
<?php
$int_shm = shmop_open(20000, 'c', 0600, 2048);
shmop_write($int_shm, 'abcd', 0);
shmop_close($int_shm);
echo "OK";
?>

file2.php
--------------------------
<?php
for($i = 0; $i < 10000; $i ++){
    $int_shm = shmop_open(20000, 'a', 0, 0);
    $str_data = trim(shmop_read($int_shm, 0, 100));
    shmop_close($int_shm);
}
echo $str_data;
echo "Done.<br />";
?>

Expected result:
----------------
Warning: shmop_open() [function.shmop-open]: unable to attach or create
shared memory segment in F:\home\share_var2.php on line 3

Warning: shmop_read() [function.shmop-read]: no shared memory segment
with an id of [0] in F:\home\share_var2.php on line 4

Warning: shmop_close() [function.shmop-close]: no shared memory segment
with an id of [0] in F:\home\share_var2.php on line 5



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47328&edit=1



Thread (2 messages)

« previous php.bugs (#133607) next »