php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56539 Apache 2 graceful restart causes a 'Cannot allocate memory' apc-error
Submitted: 2005-09-13 06:48 UTC Modified: 2009-03-02 01:22 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: webmaster at pro-g dot co dot uk Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.0.3 OS: FreeBSD 5.4-STABLE (amd64)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: webmaster at pro-g dot co dot uk
New email:
PHP Version: OS:

 

 [2005-09-13 06:48 UTC] webmaster at pro-g dot co dot uk
Description:
------------
PECL Package Version: APC 3.0.8
Apache version: 2.0.54 running as httpd
PHP compiled as Apache module (PHP 5.0.4)
Kernel Property - kern.ipc.shmmax: 33554432

Current php.ini APC settings (all default):

apc.cache_by_default: On
apc.enable_cli: Off
apc.enabled: On
apc.file_update_protection: 2
apc.filters: no value
apc.gc_ttl: 3600
apc.max_file_size: 1M
apc.num_files_hint: 1000
apc.optimization: Off
apc.shm_segments: 1
apc.shm_size: 30
apc.slam_defense: Off
apc.ttl: 0
apc.user_entries_hint: 100
apc.user_ttl: 0

----------
Problem:

The problem occurs when Apache is gracefully restarted, but is fine when apache is stopped and started.  As you can see, the kernel max segment size is 33 meg, so I can't see why this is failing.

Reproduce code:
---------------
n/a

Expected result:
----------------
Successful apache restart.

Actual result:
--------------
[Tue Sep 13 06:02:07 2005] [notice] Graceful restart requested, doing restart
[Tue Sep 13 06:02:07 2005] [apc-error] apc_shm_create: shmget(0, 31457280,914) failed: Cannot allocate memory. It is possible that the chosen SHM segment
size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-24 00:13 UTC] rasmus@php.net
Try current CVS and build APC using --enable-apc-mmap
 [2006-03-13 06:27 UTC] webmaster at euro-ro dot net
same happens with:
FreeBSD 4.11-RELEASE
apache 2.0.55 (mpm/prefork)
php 4.4.2
apc 3.0.10

the php CLI fails to start with same error when apache is running with APC at the same time.

[apc-error] apc_shm_create: shmget(0, 31457280,914) failed: Cannot allocate memory.
 [2006-10-27 14:05 UTC] phpbugs at thequod dot de
Reporters, is this still an issue?
 [2008-12-21 15:45 UTC] demichej at hotmail dot com
Yes, this still appears to be a problem.
 [2009-03-02 01:22 UTC] shire@php.net
Because you're attempting a graceful restart you're going to require double the shm_size as you will have new processes as well as processing yet to have exited, the previous memory cannot be free'd until those requests have completed.

Please try using mmap as Rasmus suggested or increasing your kernel's limit on the shared memory segment size.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 17:01:24 2020 UTC