|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59720 when setting /tmp/apc.XXXXXX php / apc crashes
Submitted: 2011-04-19 05:17 UTC Modified: 2011-04-20 10:00 UTC
From: stefan at prie dot be Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.2.17 OS: Debian
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:
Bug Type:
From: stefan at prie dot be
New email:
PHP Version: OS:


 [2011-04-19 05:17 UTC] stefan at prie dot be

i wanted to achieve that mmap is using /tmp/apc.XXXXXX by default without setting this mask in the php.ini.

Todo that i changed one line of the code in php_apc.c
STD_PHP_INI_ENTRY("apc.mmap_file_mask",  NULL,  PHP_INI_SYSTEM, OnUpdateString,         mmap_file_mask,   zend_apc_globals, apc_globals)


STD_PHP_INI_ENTRY("apc.mmap_file_mask",  "/tmp/apc.XXXXXX",  PHP_INI_SYSTEM, OnUpdateString,         mmap_file_mask,   zend_apc_globals, apc_globals)

APC sadly crashes on startup then see backtrace below.

When i insert 
in php.ini it works fine.

Actual result:
(gdb) run
Starting program: /usr/local/php5/bin/php 
[Thread debugging using libthread_db enabled]
[New Thread 0xb715bb00 (LWP 25650)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb715bb00 (LWP 25650)]
0xb73d9abd in ?? () from /lib/
(gdb) bt
#0  0xb73d9abd in ?? () from /lib/
#1  0xb74458cd in mkstemp () from /lib/
#2  0xb70475a3 in apc_mmap (file_mask=0xb704ed3e "/tmp/apc.XXXXXX", size=16777216) at /usr/local/src/APC-3.1.7/apc_mmap.c:111
#3  0xb704839c in apc_sma_init (numseg=1, segsize=16777216, mmap_file_mask=0xb704ed3e "/tmp/apc.XXXXXX")
    at /usr/local/src/APC-3.1.7/apc_sma.c:371
#4  0xb70460f6 in apc_module_init (module_number=46) at /usr/local/src/APC-3.1.7/apc_main.c:805
#5  0xb703c18b in zm_startup_apc (type=1, module_number=46) at /usr/local/src/APC-3.1.7/php_apc.c:349
#6  0x083d8a8f in zend_startup_module_ex (module=0xa0a51f8) at /usr/local/src/php-5.2.17/Zend/zend_API.c:1472
#7  0x083dd703 in zend_hash_apply (ht=0x86e3cc0, apply_func=0x83d8a20 <zend_startup_module_ex>)
    at /usr/local/src/php-5.2.17/Zend/zend_hash.c:673
#8  0x083d74ce in zend_startup_modules () at /usr/local/src/php-5.2.17/Zend/zend_API.c:1519
#9  0x08392c3a in php_module_startup (sf=0x86d8ba8, additional_modules=0x86d8bc0, num_additional_modules=1)
    at /usr/local/src/php-5.2.17/main/main.c:1855
#10 0x08441091 in php_cgi_startup (sapi_module=0x86d8b20) at /usr/local/src/php-5.2.17/sapi/cgi/cgi_main.c:714
#11 0x08441932 in main (argc=1, argv=0xbf9c2be4) at /usr/local/src/php-5.2.17/sapi/cgi/cgi_main.c:1500


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-19 09:04 UTC]
You are filing a bug on your own code?
man mkstemp
 [2011-04-19 09:17 UTC] stefan at prie dot be
Sorry for that. I just wanted to make file mmap default instead of anonymous memory alloc which results in segfaults every now and then for me.

I expected that inserting /tmp/apc.XXXXXX is the same like putting apc.mmap_file_mask="/tmp/apc.XXXXXX" in the php.ini. What is wrong about my thought?
 [2011-04-20 10:00 UTC] stefan at prie dot be
could you please me to my failure? i can't find it.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Nov 28 10:01:26 2023 UTC