|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47328 shmop_open memory leak cause apache crash
Submitted: 2009-02-06 10:26 UTC Modified: 2009-02-08 15:59 UTC
From: hszheng at gmail dot com Assigned:
Status: Not a bug Package: Semaphore related
PHP Version: 5.2.9RC1 OS: win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: hszheng at gmail dot com
New email:
PHP Version: OS:


 [2009-02-06 10:26 UTC] hszheng at gmail dot com
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:
$int_shm = shmop_open(20000, 'c', 0600, 2048);
shmop_write($int_shm, 'abcd', 0);
echo "OK";

for($i = 0; $i < 10000; $i ++){
    $int_shm = shmop_open(20000, 'a', 0, 0);
    $str_data = trim(shmop_read($int_shm, 0, 100));
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-08 15:59 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

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.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 05:03:33 2022 UTC