php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61008 not enough shared memory left
Submitted: 2012-02-08 10:32 UTC Modified: -
Votes:9
Avg. Score:4.0 ± 0.9
Reproduced:8 of 8 (100.0%)
Same Version:4 (50.0%)
Same OS:0 (0.0%)
From: shenkong at qq dot com Assigned:
Status: Open Package: Semaphore related
PHP Version: 5.3.10 OS: CentOS 6.0
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-02-08 10:32 UTC] shenkong at qq dot com
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 10:01:27 2019 UTC