|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-07-31 11:48 UTC] spam2 at rhsoft dot net
Description: ------------ a hardened build of PHP7 with "opcache.interned_strings_buffer = 8" crashs terrible Sun Jul 31 13:40:26 2016 (11663): Fatal Error Zend OPcache cannot allocate buffer for interned strings https://bugs.php.net/bug.php?id=70428 suggests there was something similar in the past, but with PHP 5.6 this problem don't exist the whole last year while PHP as mod_php crashs from beta to 7.0.9, i just gave up trying get the beta running a year ago with "hmm apache module obviously broken" and now started real testing of a migration _______________________________________ optflags: x86_64 -m64 -O2 -g0 -march=sandybridge -mtune=sandybridge -mavx -fopenmp -mfpmath=sse -pipe -fno-strict-aliasing -fomit-frame-pointer -finline-functions -fexceptions -fstack-protector-strong --param=ssp-buffer-size=6 -D_FORTIFY_SOURCE=2 -Wstack-protector -Wformat -Werror=format-security export CFLAGS="%{optflags} -O3 -fPIC -funroll-loops -funswitch-loops -Wno-pointer-sign -minline-all-stringops" export CXXFLAGS="$CFLAGS" export LDFLAGS="-Wl,-z,now -Wl,-z,relro,-z,noexecstack -pie %{optflags} -O3 -funroll-loops -funswitch-loops -Wno-pointer-sign -minline-all-stringops" export SH_LDFLAGS="-Wl,-z,now -Wl,-z,relro,-z,noexecstack %{optflags} -O3 -funroll-loops -funswitch-loops -Wno-pointer-sign -minline-all-stringops" _______________________________________ open("/lib64/liblber-2.4.so.2", O_RDONLY|O_CLOEXEC) = 6 read(6, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p3\0\0\0\0\0\0"..., 832) = 832 fstat(6, {st_mode=S_IFREG|0755, st_size=60816, ...}) = 0 mmap(NULL, 2154984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0) = 0x7f3137b9a000 mprotect(0x7f3137ba8000, 2093056, PROT_NONE) = 0 mmap(0x7f3137da7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0xd000) = 0x7f3137da7000 close(6) = 0 open("/lib64/libldap-2.4.so.2", O_RDONLY|O_CLOEXEC) = 6 read(6, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\343\0\0\0\0\0\0"..., 832) = 832 fstat(6, {st_mode=S_IFREG|0755, st_size=333496, ...}) = 0 mmap(NULL, 2426232, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0) = 0x7f3137949000 mprotect(0x7f3137997000, 2093056, PROT_NONE) = 0 mmap(0x7f3137b96000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0x4d000) = 0x7f3137b96000 close(6) = 0 open("/lib64/libunistring.so.2", O_RDONLY|O_CLOEXEC) = 6 read(6, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\374\0\0\0\0\0\0"..., 832) = 832 fstat(6, {st_mode=S_IFREG|0755, st_size=1240184, ...}) = 0 mmap(NULL, 3338504, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0) = 0x7f3137619000 mprotect(0x7f3137744000, 2097152, PROT_NONE) = 0 mmap(0x7f3137944000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0x12b000) = 0x7f3137944000 mmap(0x7f3137948000, 264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3137948000 close(6) = 0 open("/lib64/libsasl2.so.3", O_RDONLY|O_CLOEXEC) = 6 read(6, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`H\0\0\0\0\0\0"..., 832) = 832 fstat(6, {st_mode=S_IFREG|0755, st_size=120136, ...}) = 0 mmap(NULL, 2213768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0) = 0x7f3136cdd000 mprotect(0x7f3136cf9000, 2093056, PROT_NONE) = 0 mmap(0x7f3136ef8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0x1b000) = 0x7f3136ef8000 close(6) = 0 mprotect(0x7f3136ef8000, 4096, PROT_READ) = 0 mprotect(0x7f3137944000, 12288, PROT_READ) = 0 mprotect(0x7f3137fe3000, 4096, PROT_READ) = 0 mprotect(0x7f31383ef000, 4096, PROT_READ) = 0 mprotect(0x7f31381eb000, 4096, PROT_READ) = 0 mprotect(0x7f3138617000, 28672, PROT_READ) = 0 mprotect(0x7f313893f000, 20480, PROT_READ) = 0 mprotect(0x7f3138db1000, 16384, PROT_READ) = 0 mprotect(0x7f3138b6b000, 12288, PROT_READ) = 0 mprotect(0x7f3137da7000, 4096, PROT_READ) = 0 mprotect(0x7f3137b96000, 12288, PROT_READ) = 0 mprotect(0x7f3139424000, 4096, PROT_READ) = 0 mprotect(0x7f3138fc2000, 4096, PROT_READ) = 0 mprotect(0x7f31391f0000, 4096, PROT_READ) = 0 mprotect(0x7f3139645000, 4096, PROT_READ) = 0 mprotect(0x7f313985c000, 4096, PROT_READ) = 0 mprotect(0x7f3139c8e000, 4096, PROT_READ) = 0 mprotect(0x7f313a115000, 12288, PROT_READ) = 0 mprotect(0x7f313a321000, 4096, PROT_READ) = 0 mprotect(0x7f313aacb000, 8192, PROT_READ) = 0 mprotect(0x7f313acfb000, 16384, PROT_READ) = 0 mprotect(0x7f313af27000, 4096, PROT_READ) = 0 mprotect(0x7f313b15a000, 8192, PROT_READ) = 0 mprotect(0x7f313bd1f000, 602112, PROT_READ) = 0 munmap(0x7f313b160000, 73824) = 0 read(5, "", 4096) = 0 close(5) = 0 rt_sigaction(SIGSEGV, {0x561fab022810, [], SA_RESTORER|SA_RESETHAND, 0x7f313ec33c30}, NULL, 8) = 0 rt_sigaction(SIGBUS, {0x561fab022810, [], SA_RESTORER|SA_RESETHAND, 0x7f313ec33c30}, NULL, 8) = 0 rt_sigaction(SIGABRT, {0x561fab022810, [], SA_RESTORER|SA_RESETHAND, 0x7f313ec33c30}, NULL, 8) = 0 rt_sigaction(SIGILL, {0x561fab022810, [], SA_RESTORER|SA_RESETHAND, 0x7f313ec33c30}, NULL, 8) = 0 rt_sigaction(SIGFPE, {0x561fab022810, [], SA_RESTORER|SA_RESETHAND, 0x7f313ec33c30}, NULL, 8) = 0 chdir("/") = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f313f8bca90) = 11663 exit_group(0) = ? +++ exited with 0 +++ PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
The reason why we fail to allocate an 8MB interned string buffer with 16MB SHM is that next to the 8MB buffer, we also allocate an ~9MB hashtable. The number of elements in the HT is computed as interned_strings_buffer * 1024 * 1024 / (sizeof(Bucket) + sizeof(Bucket*) + 8 /* average string length */) This expression doesn't make a whole lot of sense, it's likely a leftover from the previous implementation. More reasonable would be interned_strings_buffer * 1024 * 1024 / _ZSTR_STRUCT_SIZE(8 /* average string length */) This is more semantically accurate, but does not solve the problem of too much memory being allocated. (I also wonder if that average is still current.) @laruence: What do you think, should this code be changed so that interned_string_buffer is (approximately) the size of the hashtable and the string buffer *combined*? A good approximation would be to cut the specified size in half before going the allocations, as the HT takes about as much memory as the buffer.