From:
Operating system: CentOS 6.0
PHP version: 5.3.10
Package: Semaphore related
Bug Type: Bug
Bug description:not enough shared memory left
Description:
------------
i run the code below in the cmd, it tooks warning Warning: shm_put_var():
not
enough shared memory left in
/usr/local/agent/bin/a.php on line 15
i set the shmmax > 100M
when the process > 1 ,the error shows
when the process = 1, it seems ok.
Test script:
---------------
#!/usr/local/services/php/bin/php
<?php
// Example
$key = ftok(__FILE__, 'a');
$shm = shm_attach($key);
shm_remove($shm);
$shm = shm_attach($key);
for($i = 0; $i < 3; $i++) {
$pid = pcntl_fork();
if ($pid) {
} else {
//child
$pid = posix_getpid();
for($i = 0; $i < 100000; $i++) {
shm_put_var($shm, $pid, microtime(true));
}
exit;
}
}
?>
Actual result:
--------------
Warning: shm_put_var(): not enough shared memory left in
/usr/local/agent/bin/a.php on line 15
--
Edit bug report at https://bugs.php.net/bug.php?id=61008&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61008&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61008&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61008&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61008&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61008&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61008&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61008&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61008&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61008&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61008&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61008&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61008&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61008&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61008&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61008&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61008&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61008&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61008&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61008&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61008&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61008&r=mysqlcfg