Opened 9 years ago

Closed 8 years ago

#15 closed defect (fixed)

pcode cache does not work

Reported by: soff@… Owned by: moo
Priority: minor Milestone:
Component: component1 Version: 1.0
Keywords: Cc:
Application: PHP Version:
Other Exts: SAPI:
Probability: Blocked By:
Blocking:

Description

xcache.size = 64M
xcache.count = 4
xcache.slots = 8K
xcache.var_size = 0
xcache.var_count = 1
xcache.var_slots = 8K
xcache.test = Off
xcache.readonly_protection = Off
xcache.mmap_path = "/tmp/xcache"

[12-Jun-2006 23:03:54] PHP Fatal error: XCache: Cannot create shm in Unknown on line 0
[12-Jun-2006 23:03:54] PHP Fatal error: XCache: Cannot init in Unknown on line 0
[12-Jun-2006 23:03:54] PHP Fatal error: Unable to start XCache module in Unknown on line 0

Change History (10)

comment:1 Changed 9 years ago by moo

it is possible that your sysctl (if linux) limit the mmap size. you may try to lower xcache.size to 4M or so and check if it works, then try to config your kernel, use sysctl or so (not rebuild, i guess)

comment:2 Changed 9 years ago by anonymous

  • Version set to 1.0

I cannot also activate xcache when I set 'xcache.mmap_path = "/tmp/xcache"'.

% php-cgi -i
PHP Fatal error:  XCache: Cannot create shm in Unknown on line 0
PHP Fatal error:  XCache: Cannot init in Unknown on line 0
PHP Fatal error:  Unable to start XCache module in Unknown on line 0

I tried on Gentoo linux (php-5.1.4) and Debian sarge (php-4.3.10-16), but in vain.

xcache.cacher = On
xcache.size = 4M
xcache.count = 1
xcache.optimizer = On
xcache.mmap_path = "/tmp/xcache"
xcache.var_size = 4M
xcache.var_count = 1
% sysctl -a | grep shm
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 33554432

With eaccelerator, I can set 'eaccelerator.shm_size="28"' and there is no problem.

comment:3 Changed 9 years ago by soff@…

well, the same with me.

# sysctl -a | grep shm
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 33554432

eaccelerator.shm_size="16" has no problem.

comment:4 Changed 9 years ago by ich@…

a strace:

open("/srv/lighttpd/php/lib/php/extensions/no-debug-non-zts-20050922/xcache.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340B\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=398063, ...}) = 0
old_mmap(NULL, 68848, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xb79ec000
old_mmap(0xb79fc000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x10000) = 0xb79fc000
close(3) = 0
futex(0xb7c90d5c, FUTEX_WAKE, 2147483647) = 0
brk(0) = 0x83fa000
brk(0x841b000) = 0x841b000
brk(0) = 0x841b000
brk(0x843c000) = 0x843c000
brk(0) = 0x843c000
brk(0x845d000) = 0x845d000
brk(0) = 0x845d000
brk(0x847e000) = 0x847e000
open("/tmp/xcache", O_RDWR) = -1 EISDIR (Is a directory)
open("/tmp/xcache", O_RDWR|O_CREAT, 0600) = -1 EISDIR (Is a directory)
open("/logs/lighthttpd/error_php.log", O_WRONLY|O_APPEND|O_CREAT, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Fatal error: XCache: Cannot"..., 65) = 65
open("/logs/lighthttpd/error_php.log", O_WRONLY|O_APPEND|O_CREAT, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Fatal error: XCache: Cannot"..., 59) = 59
open("/logs/lighthttpd/error_php.log", O_WRONLY|O_APPEND|O_CREAT, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Fatal error: Unable to star"..., 69) = 69
exit_group(-2) =

do not create a xcache dir by yourself. If you created it please delete it and xcache works :).

open("/tmp/xcache", O_RDWR) = -1 ENOENT (No such file or directory)
open("/tmp/xcache", O_RDWR|O_CREAT, 0600) = 3
ftruncate(3, 33554432) = 0
mmap2(NULL, 33554432, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0xb596f000
munmap(0, 33554432) = 0
close(3) = 0
unlink("/tmp/xcache") = 0
getuid32() = 0
open("/tmp/.xcache.0.0.1804289383.lock", O_RDWR|O_CREAT, 0666) = 3
unlink("/tmp/.xcache.0.0.1804289383.lock") = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={60, 0}}, NULL) = 0
rt_sigaction(SIGPROF, {0x822e3a0, [PROF], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
time(NULL) = 1150459866
gettimeofday({1150459866, 351317}, NULL) = 0
getpid() = 21678
time(NULL) = 1150459866
write(1, "PHP 5.1.4 (cgi-fcgi) (built: May"..., 205) = 205
exit_group(0) = ?

comment:5 Changed 9 years ago by anonymous

do not create a xcache dir by yourself. If you created it please delete it and xcache works :).

Thanks ich@toby. It works. It seems the directory which set to 'xcache.mmap_path' is created and deleted by xcache itself. I think this should be described in the documents (FAQ?).

And if 'xcache.mmap_path' is set other than /tmp directory and programs execute as a normal user, the permission of the parent directory may also be a problem.

comment:6 Changed 9 years ago by moo

thank you guys, you it fixed yourself. i'll update doc/wiki somewhere. :)

comment:7 Changed 8 years ago by anonymous

  • Milestone milestone4 deleted

comment:8 Changed 8 years ago by anonymous

  • Version changed from 2.0 to 1.0

comment:9 Changed 8 years ago by moo

  • Owner changed from somebody to moo

comment:10 Changed 8 years ago by moo

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.