php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59412 apc.slam_defense defaults to "1" as of APC 3.1.4
Submitted: 2010-09-11 14:49 UTC Modified: 2010-12-13 10:51 UTC
From: ross at thegodlikehobo dot org Assigned:
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
 [2010-09-11 14:49 UTC] ross at thegodlikehobo dot org
Description:
------------
Background info:
Ubuntu 10.04.1
PEAR Version: 1.9.1
PHP Version: 5.3.3 (built from source with Suhosin patch 0.9.10)
APC 3.1.3p1 and 3.1.4 (installed via PECL)

Upon upgrading from APC 3.1.3p1 to 3.1.4, I noticed a slew of "apc_store(): Potential cache slam averted for key" PHP warnings in my logs.
Despite the APC changelog and runtime configuration doc stating apc.slam_defense has been deprecated since 3.0.11 and should default to 0, it is set to "1" by default in 3.1.4. If I understand this option correctly, such a low number would be the cause of so many PHP warnings.

Configuration and runtime details for the two APC versions:

####

3.1.3p1

APC configuration:

apc.cache_by_default =          1
apc.coredump_unmap =            0
apc.enable_cli =                0
apc.enabled =                   1
apc.file_update_protection =    2
apc.gc_ttl =                    600
apc.include_once_override =     0
apc.max_file_size =             4M
apc.shm_segments=               1
apc.shm_size =                  64
apc.stat =                      1
apc.stat_ctime =                1
apc.ttl =                       3600
apc.write_lock =                1
apc.mmap_file_mask =            /dev/zero
apc.user_ttl =                  3600
apc.user_entries_hint =         300
apc.num_files_hint =            400

Runtime settings as reported by APC INFO:

apc.cache_by_default		1
apc.canonicalize		1
apc.coredump_unmap		0
apc.enable_cli			0
apc.enabled			1
apc.file_md5			0
apc.file_update_protection	2
apc.filters	
apc.gc_ttl			600
apc.include_once_override	0
apc.lazy_classes		0
apc.lazy_functions		0
apc.max_file_size		4M
apc.mmap_file_mask		/dev/zero
apc.num_files_hint		400
apc.preload_path	
apc.report_autofilter		0
apc.rfc1867			0
apc.rfc1867_freq		0
apc.rfc1867_name		APC_UPLOAD_PROGRESS
apc.rfc1867_prefix		upload_
apc.rfc1867_ttl			3600
apc.shm_segments		1
apc.shm_size			64
apc.stat			1
apc.stat_ctime			1
apc.ttl	3600
apc.use_request_time		1
apc.user_entries_hint		300
apc.user_ttl			3600
apc.write_lock			1

####

3.1.4

APC configuration:

apc.cache_by_default =          1
apc.coredump_unmap =            0
apc.enable_cli =                0
apc.enabled =                   1
apc.file_update_protection =    2
apc.gc_ttl =                    600
apc.include_once_override =     0
apc.max_file_size =             4M
apc.shm_segments=               1
apc.shm_size =                  64M
apc.stat =                      1
apc.stat_ctime =                1
apc.ttl =                       3600
apc.write_lock =                1
apc.mmap_file_mask =            /dev/zero
apc.user_ttl =                  3600
apc.user_entries_hint =         300
apc.num_files_hint =            400

Runtime settings as reported by APC INFO:

apc.cache_by_default		1
apc.canonicalize		1
apc.coredump_unmap		0
apc.enable_cli			0
apc.enabled			1
apc.file_md5			0
apc.file_update_protection	2
apc.filters	
apc.gc_ttl			600
apc.include_once_override	0
apc.lazy_classes		0
apc.lazy_functions		0
apc.max_file_size		4M
apc.mmap_file_mask		/dev/zero
apc.num_files_hint		400
apc.preload_path	
apc.report_autofilter		0
apc.rfc1867			0
apc.rfc1867_freq		0
apc.rfc1867_name		APC_UPLOAD_PROGRESS
apc.rfc1867_prefix		upload_
apc.rfc1867_ttl	3600
apc.shm_segments		1
apc.shm_size			64M
apc.slam_defense		1
apc.stat			1
apc.stat_ctime			1
apc.ttl				3600
apc.use_request_time		1
apc.user_entries_hint		300
apc.user_ttl			3600
apc.write_lock			1

####

As you can see, in neither configuration is apc.slam_defense set. APC INFO does not list the option with 3.1.3p1 and shows it set to "1" with 3.1.4.

The PHP warnings have ceased since adding "apc.slam_defense = 0" to my APC 3.1.4 configuration.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-14 09:45 UTC] dennisml at conversis dot de
I just ran into the same problem.
Either the documentation or the source should be fixed depending on what the true intended default value is supposed to be.
 [2010-10-27 00:29 UTC] sdfsdr at mailinator dot com
The slew of warnings are likely because of this bug: http://pecl.php.net/bugs/bug.php?id=18624

Slam defense (if its working properly) should be a good idea to have enabled to help spot issues with your code doing multiple caching of the same object.
 [2010-12-13 10:50 UTC] ross at thegodlikehobo dot org
Background info:
Ubuntu 10.04.1
PEAR Version: 1.9.1
PHP Version: 5.3.3 (built from source with Suhosin patch 0.9.10)
APC 3.1.3p1 and 3.1.4 (installed via PECL)

Upon upgrading from APC 3.1.3p1 to 3.1.4, I noticed a slew of
"apc_store(): Potential cache slam averted for key" PHP warnings in my
logs.
Despite the APC changelog and runtime configuration doc stating
apc.slam_defense has been deprecated since 3.0.11 and should default to 0,
it is set to "1" by default in 3.1.4. If I understand this option
correctly, such a low number would be the cause of so many PHP warnings.

Configuration and runtime details for the two APC versions:

####

3.1.3p1

APC configuration:

apc.cache_by_default =          1
apc.coredump_unmap =            0
apc.enable_cli =                0
apc.enabled =                   1
apc.file_update_protection =    2
apc.gc_ttl =                    600
apc.include_once_override =     0
apc.max_file_size =             4M
apc.shm_segments=               1
apc.shm_size =                  64
apc.stat =                      1
apc.stat_ctime =                1
apc.ttl =                       3600
apc.write_lock =                1
apc.mmap_file_mask =            /dev/zero
apc.user_ttl =                  3600
apc.user_entries_hint =         300
apc.num_files_hint =            400

Runtime settings as reported by APC INFO:

apc.cache_by_default		1
apc.canonicalize		1
apc.coredump_unmap		0
apc.enable_cli			0
apc.enabled			1
apc.file_md5			0
apc.file_update_protection	2
apc.filters	
apc.gc_ttl			600
apc.include_once_override	0
apc.lazy_classes		0
apc.lazy_functions		0
apc.max_file_size		4M
apc.mmap_file_mask		/dev/zero
apc.num_files_hint		400
apc.preload_path	
apc.report_autofilter		0
apc.rfc1867			0
apc.rfc1867_freq		0
apc.rfc1867_name		APC_UPLOAD_PROGRESS
apc.rfc1867_prefix		upload_
apc.rfc1867_ttl			3600
apc.shm_segments		1
apc.shm_size			64
apc.stat			1
apc.stat_ctime			1
apc.ttl	3600
apc.use_request_time		1
apc.user_entries_hint		300
apc.user_ttl			3600
apc.write_lock			1

####

3.1.4

APC configuration:

apc.cache_by_default =          1
apc.coredump_unmap =            0
apc.enable_cli =                0
apc.enabled =                   1
apc.file_update_protection =    2
apc.gc_ttl =                    600
apc.include_once_override =     0
apc.max_file_size =             4M
apc.shm_segments=               1
apc.shm_size =                  64M
apc.stat =                      1
apc.stat_ctime =                1
apc.ttl =                       3600
apc.write_lock =                1
apc.mmap_file_mask =            /dev/zero
apc.user_ttl =                  3600
apc.user_entries_hint =         300
apc.num_files_hint =            400

Runtime settings as reported by APC INFO:

apc.cache_by_default		1
apc.canonicalize		1
apc.coredump_unmap		0
apc.enable_cli			0
apc.enabled			1
apc.file_md5			0
apc.file_update_protection	2
apc.filters	
apc.gc_ttl			600
apc.include_once_override	0
apc.lazy_classes		0
apc.lazy_functions		0
apc.max_file_size		4M
apc.mmap_file_mask		/dev/zero
apc.num_files_hint		400
apc.preload_path	
apc.report_autofilter		0
apc.rfc1867			0
apc.rfc1867_freq		0
apc.rfc1867_name		APC_UPLOAD_PROGRESS
apc.rfc1867_prefix		upload_
apc.rfc1867_ttl	3600
apc.shm_segments		1
apc.shm_size			64M
apc.slam_defense		1
apc.stat			1
apc.stat_ctime			1
apc.ttl				3600
apc.use_request_time		1
apc.user_entries_hint		300
apc.user_ttl			3600
apc.write_lock			1

####

As you can see, in neither configuration is apc.slam_defense set. APC INFO
does not list the option with 3.1.3p1 and shows it set to "1" with 3.1.4.

The PHP warnings have ceased since adding "apc.slam_defense = 0" to my APC
3.1.4 configuration.
 [2010-12-13 10:51 UTC] ross at thegodlikehobo dot org
As of 3.1.6, application behavior which previously generated "apc_store(): Potential cache slam averted for key" errors no longer does so. Perhaps due to the changes in SVN revision 305258.

Whatever the reason, I believe this is merely a documentation issue and have opened a bug report at http://bugs.php.net/bug.php?id=53538.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC