kn007的个人博客
♥ You are here: Home > 软件与网络 > php > PHP7莫名其妙的问题

PHP7莫名其妙的问题

by | 31 Comments

提醒:本文最后更新于 3253 天前,文中所描述的信息可能已发生改变,请仔细核实。

6b8cf6b2baedcde8275905077d4d96bdPHP 7最近出现了一堆signal 7 (SIGBUS),内核没报错。

最后查到是PHP在发送邮件的时候,会出现signal 7 (SIGBUS)退出,但是没core dump。

发现这个问题的引起主要是因为pm的方式引起的,当pm为static时,一定概率触发,试了下超过60%机率出现signal 7。

发送邮件后(WP回复评论会发送邮件),会有几个php-fpm子进程100%CPU。Strace的话,提示:

mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd600000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd400000
munmap(0x7f75cd600000, 2097152)         = 0
munmap(0x7f75cd400000, 2097152)         = 0
gettimeofday({1451528698, 11508}, NULL) = 0
gettimeofday({1451528698, 12114}, NULL) = 0
gettimeofday({1451528698, 12427}, NULL) = 0
gettimeofday({1451528698, 14962}, NULL) = 0
gettimeofday({1451528698, 15752}, NULL) = 0
sendto(5, "\343\0\0\0\3SELECT  COUNT(*) FROM wp_co"..., 231, MSG_DONTWAIT, NULL, 0) = 231
poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
recvfrom(5, "\1\0\0\1\1\36\0\0\2\3def\0\0\0\10COUNT(*)\0\f?\0\25\0\0"..., 3593, MSG_DONTWAIT, NULL, NULL) = 64
gettimeofday({1451528698, 18059}, NULL) = 0
gettimeofday({1451528698, 18186}, NULL) = 0
gettimeofday({1451528698, 19500}, NULL) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd600000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd400000
munmap(0x7f75cd600000, 2097152)         = 0
munmap(0x7f75cd400000, 2097152)         = 0
gettimeofday({1451528698, 619828}, NULL) = 0
gettimeofday({1451528698, 620468}, NULL) = 0
gettimeofday({1451528698, 620648}, NULL) = 0
gettimeofday({1451528698, 623313}, NULL) = 0
gettimeofday({1451528698, 623399}, NULL) = 0
write(4, "\1\6\0\1\37\370\0\0pan class='unapprove'><a"..., 8192) = 8192
gettimeofday({1451528698, 624614}, NULL) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd600000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd400000
munmap(0x7f75cd600000, 2097152)         = 0
munmap(0x7f75cd400000, 2097152)         = 0
gettimeofday({1451528699, 174767}, NULL) = 0
gettimeofday({1451528699, 175348}, NULL) = 0
gettimeofday({1451528699, 175525}, NULL) = 0
gettimeofday({1451528699, 177720}, NULL) = 0
gettimeofday({1451528699, 178301}, NULL) = 0
sendto(5, "\343\0\0\0\3SELECT  COUNT(*) FROM wp_co"..., 231, MSG_DONTWAIT, NULL, 0) = 231
poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
recvfrom(5, "\1\0\0\1\1\36\0\0\2\3def\0\0\0\10COUNT(*)\0\f?\0\25\0\0"..., 3529, MSG_DONTWAIT, NULL, NULL) = 63
gettimeofday({1451528699, 180599}, NULL) = 0
gettimeofday({1451528699, 180695}, NULL) = 0
write(4, "\1\6\0\1\37\370\0\0003426aa140798254bc4a2f709"..., 8192) = 8192
gettimeofday({1451528699, 181823}, NULL) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd600000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd400000
munmap(0x7f75cd600000, 2097152)         = 0
munmap(0x7f75cd400000, 2097152)         = 0
gettimeofday({1451528699, 717006}, NULL) = 0
gettimeofday({1451528699, 717593}, NULL) = 0
gettimeofday({1451528699, 717767}, NULL) = 0
sendto(6, "get wp_:posts:4703\r\n", 20, MSG_NOSIGNAL, NULL, 0) = 20
recvfrom(6, 0x255e408, 8196, 16384, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=6, events=POLLIN}], 1, 5000)  = 1 ([{fd=6, revents=POLLIN}])
recvfrom(6, "VALUE wp_:posts:4703 84 5620\r\n7C"..., 8196, MSG_NOSIGNAL, NULL, NULL) = 5657
gettimeofday({1451528699, 720344}, NULL) = 0
gettimeofday({1451528699, 720839}, NULL) = 0
sendto(5, "\343\0\0\0\3SELECT  COUNT(*) FROM wp_co"..., 231, MSG_DONTWAIT, NULL, 0) = 231
poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
recvfrom(5, "\1\0\0\1\1\36\0\0\2\3def\0\0\0\10COUNT(*)\0\f?\0\25\0\0"..., 3466, MSG_DONTWAIT, NULL, NULL) = 64
gettimeofday({1451528699, 722824}, NULL) = 0
gettimeofday({1451528699, 722916}, NULL) = 0
gettimeofday({1451528699, 724090}, NULL) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd600000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd400000
munmap(0x7f75cd600000, 2097152)         = 0
munmap(0x7f75cd400000, 2097152)         = 0
gettimeofday({1451528700, 286251}, NULL) = 0
gettimeofday({1451528700, 286823}, NULL) = 0
gettimeofday({1451528700, 287050}, NULL) = 0
gettimeofday({1451528700, 289651}, NULL) = 0
gettimeofday({1451528700, 289738}, NULL) = 0
write(4, "\1\6\0\1\37\370\0\0\260\206\350\277\231\346\235\241\350\257\204\350\256\272\346\240\207\350\256\260\344\270\27
2\345"..., 8192) = 8192
gettimeofday({1451528700, 291098}, NULL) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd600000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f75cd400000
munmap(0x7f75cd600000, 2097152)         = 0
munmap(0x7f75cd400000, 2097152)         = 0
gettimeofday({1451528700, 847193}, NULL) = 0
gettimeofday({1451528700, 847711}, NULL) = 0
gettimeofday({1451528700, 847902}, NULL) = 0
gettimeofday({1451528700, 849289}, NULL) = 0
gettimeofday({1451528700, 849403}, NULL) = 0
sendto(6, "get wp_site-options:0:notoptions"..., 34, MSG_NOSIGNAL, NULL, 0) = 34
recvfrom(6, 0x255e408, 8196, 16384, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=6, events=POLLIN}], 1, 5000)  = 1 ([{fd=6, revents=POLLIN}])
recvfrom(6, "END\r\n", 8196, MSG_NOSIGNAL, NULL, NULL) = 5
write(4, "\1\6\0\1\37\370\0\0&#111;&#109;\">&#111;u&#1"..., 8192) = 8192
gettimeofday({1451528700, 851143}, NULL) = 0
write(4, "\1\6\0\1\37\370\0\0\"\" />\n\t<input type=\"hidd"..., 8192) = 8192
sendto(6, "get wp_site-options:0:notoptions"..., 34, MSG_NOSIGNAL, NULL, 0) = 34
recvfrom(6, 0x255e408, 8196, 16384, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=6, events=POLLIN}], 1, 5000)  = 1 ([{fd=6, revents=POLLIN}])
recvfrom(6, "END\r\n", 8196, MSG_NOSIGNAL, NULL, NULL) = 5
chdir("/")                              = 0
clock_gettime(CLOCK_MONOTONIC, {972, 990941706}) = 0
times({tms_utime=1740, tms_stime=20, tms_cutime=0, tms_cstime=0}) = 429498734
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
sendto(6, "quit\r\n", 6, MSG_NOSIGNAL, NULL, 0) = 6
shutdown(6, SHUT_WR)                    = 0
shutdown(6, SHUT_RD)                    = 0
close(6)                                = 0
munmap(0x7f75ca000000, 2359296)         = 0
sendto(5, "\1\0\0\0\1", 5, MSG_DONTWAIT, NULL, 0) = 5
close(5)                                = 0
write(4, "\1\6\0\1\n\35\3\0int screen-reader-text\">"..., 2616) = 2616
shutdown(4, SHUT_WR)                    = 0
recvfrom(4, "\1\5\0\1\0\0\0\0", 8, 0, NULL, NULL) = 8
close(4)                                = 0
clock_gettime(CLOCK_MONOTONIC, {973, 26167354}) = 0
munmap(0x7f75c9c00000, 2097152)         = 0
munmap(0x7f75c9e00000, 2097152)         = 0
munmap(0x7f75ca400000, 2097152)         = 0
munmap(0x7f75ca600000, 2097152)         = 0
munmap(0x7f75ca800000, 2097152)         = 0
munmap(0x7f75caa00000, 2097152)         = 0
munmap(0x7f75cac00000, 2097152)         = 0
munmap(0x7f75cae00000, 2097152)         = 0
munmap(0x7f75cb000000, 2097152)         = 0
munmap(0x7f75cb200000, 2097152)         = 0
munmap(0x7f75cb400000, 2097152)         = 0
munmap(0x7f75cb600000, 2097152)         = 0
munmap(0x7f75cb800000, 2097152)         = 0
munmap(0x7f75cba00000, 2097152)         = 0
munmap(0x7f75cbc00000, 2097152)         = 0
munmap(0x7f75cbe00000, 2097152)         = 0
munmap(0x7f75cc000000, 2097152)         = 0
munmap(0x7f75cc200000, 2097152)         = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {973, 42458233}) = 0
accept(0,

如果没有进程100%CPU,那就是触发signal 7 (SIGBUS)退出了。。内核没报错,应该是PHP 7自身问题。不使用任意扩展(仅使用opcache)也会出现这个问题。

php.ini有关邮件的只有这一项:

sendmail_path = /usr/sbin/sendmail.postfix -t -i

这个应该不会出现任何问题才对吧。

当然出现问题时,是在Wordpress下测试的,也有可能Wordpress函数有问题?

但是没收到任何notice、warning、error,已经启用了catch_workers_output,没看到任何有用的错误输出。只看到:

ERROR: unable to read what child say: Bad file descriptor (9)

何解!?

另外pm在ondemand下比较正常,起码没有signal 7 (SIGBUS),但是发完邮件php还是会一卡一卡的。

一开始以为是跟内核(3.10.94-elrepo)有关系,使用旧内核(2.6.32)来测试,没有输出core dump,尝试用igbinary,出现segmentation fault后,内核输出了core dump,所以跟内核没关系。

在漫长的等待中,被我等到了!(好吧,发现BUG的心情,总是让人那么的喜悦,我肯定是病得不清。另外定时文章的好处出来了,在正式发布之前,随时可以修改草稿。。永远不怕时间流逝,最终展示给大家总是最新的消息。省去后期修改文章后,无人知,无人问津)

php-fpm.log输出:

WARNING: [pool www] child 14105 said into stderr: "sendmail.postfix: fatal: no-reply@kn007.net(50
0): No recipient addresses found in message header"
WARNING: [pool www] child 14105 exited on signal 7 (SIGBUS - core dumped) after 102.008292 second
s from start
NOTICE: [pool www] child 14572 started
WARNING: [pool www] child 14116 said into stderr: "sendmail.postfix: fatal: no-reply@kn007.net(50
0): No recipient addresses found in message header"
WARNING: [pool www] child 14116 exited on signal 7 (SIGBUS - core dumped) after 109.518224 second
s from start
NOTICE: [pool www] child 14575 started
WARNING: [pool www] child 14076 exited on signal 7 (SIGBUS - core dumped) after 115.480386 second
s from start
NOTICE: [pool www] child 14577 started
WARNING: [pool www] child 14079 said into stderr: "sendmail.postfix: fatal: no-reply@kn007.net(50
0): No recipient addresses found in message header"
WARNING: [pool www] child 14079 exited on signal 7 (SIGBUS - core dumped) after 121.723991 second
s from start
NOTICE: [pool www] child 14581 started

core dump输出:

...

Core was generated by `php-fpm: pool www                                                             '.
Program terminated with signal 7, Bus error.
#0  0x00000000009af0aa in zend_mm_free_small (heap=0x7fc7ca600040, ptr=0x7fc7c3c5b000, bin_num=10)
    at /data/src/php-7.0.1/Zend/zend_alloc.c:1303
1303            heap->size -= bin_data_size[bin_num];
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.5-7.el6_0.x86_64 cyrus-sasl-lib-2.1.23-15.el6_6.2.x86
_64 libgcc-4.4.7-16.el6.x86_64 libidn-1.18-2.el6.x86_64 libmcrypt-2.5.8-9.el6.x86_64 libpng-1.2.49-2.el6_7.x86_64 libstd
c++-4.4.7-16.el6.x86_64 nspr-4.10.8-2.el6_7.x86_64 nss-3.19.1-5.el6_7.x86_64 nss-util-3.19.1-2.el6_7.x86_64 openldap-2.4
.40-7.el6_7.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0  0x00000000009af0aa in zend_mm_free_small (heap=0x2aaaaac00040, ptr=0x2aaab30b7070, bin_num=10) at /data/src/php-7.0.1/Zend/zend_alloc.c:1303
#1  0x00000000009af499 in zend_mm_free_heap (heap=0x2aaaaac00040, ptr=0x2aaab30b7070, __zend_filename=0xd397e0 "/data/src/php-7.0.1/ext/standard/mail.c",
    __zend_lineno=381, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /data/src/php-7.0.1/Zend/zend_alloc.c:1402
#2  0x00000000009b1cdc in _efree (ptr=0x2aaab30b7070, __zend_filename=0xd397e0 "/data/src/php-7.0.1/ext/standard/mail.c", __zend_lineno=381,
    __zend_orig_filename=0x0, __zend_orig_lineno=0) at /data/src/php-7.0.1/Zend/zend_alloc.c:2458
#3  0x0000000000856405 in php_mail (to=0x2aaab30a2b60 "kn007@126.com",
    subject=0x2aaab3088680 "=?UTF-8?B?5oSf6LCi5oKo5LiA55u05Lul5p2l5a+55oiR5Lus55qE5YWz5b+D5ZKM5pSv?=  =?UTF-8?B?5oyB?=",
    message=0x2aaab306f418 "<!DOCTYPE html>\n\t\t\t<div style=\"background-color:#fff; border:1px solid #666666; color:#111;\n\t\t -moz-border-radius:8px; -we
bkit-border-radius:8px; -khtml-border-radius:8px; \n\t\tborder-radius:8px; font-s"...,
    headers=0x2aaaaac73398 "Date: Fri, 1 Jan 2016 04:16:16 +0000\nFrom: kn007's blog <no-reply@kn007.net>\nMessage-ID: <2c97c803b9ad1c4872b11a6491ea5a16@defau
lt>\nX-Priority: 3\nX-Mailer: PHPMailer 5.2.10 (https://github.com/PHPMail"..., extra_cmd=0x2aaab30896d8 " ") at /data/src/php-7.0.1/ext/standard/mail.c:381
#4  0x0000000000855d61 in zif_mail (execute_data=0x2aaaaac15ac0, return_value=0x2aaaaac15aa0) at /data/src/php-7.0.1/ext/standard/mail.c:174
#5  0x0000000000a3f0b8 in ZEND_DO_ICALL_SPEC_HANDLER () at /data/src/php-7.0.1/Zend/zend_vm_execute.h:586
#6  0x0000000000a3eaf0 in execute_ex (ex=0x2aaaaac15030) at /data/src/php-7.0.1/Zend/zend_vm_execute.h:414
#7  0x0000000000a3ec05 in zend_execute (op_array=0x2aaaaac7d000, return_value=0x0) at /data/src/php-7.0.1/Zend/zend_vm_execute.h:458
#8  0x00000000009e4c0c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /data/src/php-7.0.1/Zend/zend.c:1428
#9  0x0000000000957e2f in php_execute_script (primary_file=0x7ffdce61ecb0) at /data/src/php-7.0.1/main/main.c:2471
#10 0x0000000000ab1b4f in main (argc=6, argv=0x7ffdce61eec8) at /data/src/php-7.0.1/sapi/fpm/fpm/fpm_main.c:1944
(gdb)

目前仍然调试看下是什么问题,如果解决不了,就只能提交issue了。

最新进展:
用wp_mail()函数就有问题,用mail()就没有。
重启php-fpm,两者都正常,看来还要运行一段时间才行。

已联系鸟哥。。元旦居然没出去玩。
结果鸟哥说core dump被内存跑花了,难以分析。说看下能不能在命令行重现。
在我把wordpress的wp_mail独立出来后,在命令行跑都没问题。
最终hugepage不够的情况下,一直signal 7,目前在编译了disable-huge-code-page的php7运行,没有问题。坑爹的是,单纯的disable-huge-code-page还不行,必须系统不存在可用hugepage块才行。太囧了。
禁用hugepage性能也下降了85%了。晕了。

简单说现在存在几个问题:
1.使用--disable-huge-code-page只是让php-fpm启动时不检测hugepage是否可用,只要有可用的hugepage就会用。真正不使用hugepage,需要将内核的hugepage禁用。但这样的话,其他要用hugepage的程序就被动了。
2.每次崩溃的时候(大部分是wp_mail发送邮件的时候),php -a,或者随便php个文件,都会提示
PHP Warning: Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory (12) in Unknown on line 0

最后测明是hugepage不够用的原因。这个只能加内存了。鸟哥说推荐16G以上来启用hugepage。
我目前空闲内存3G,分了512页,可以正常跑了。


e396e5edead35e5763ef79a92cd5d542

关于igbinary,一用就会signal 11 (SIGSEGV),内核提示segmentation fault,给igbinary官方提交issue也没任何答复,其PHP 7的兼容性看来有待考究。

使用igbinary,内核log,输出:

kn007 kernel: php-fpm[21765]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21778]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21807]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21793]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21758]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21794]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21775]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21938]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21777]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21790]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21799]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[22791]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]
kernel: php-fpm[21797]: segfault at 10 ip 00007f3fa75dc060 sp 00007ffee413d220 error 6 in igbinary
.so[7f3fa75da000+a000]

php-fpm.log出现比较多的,类似这样的提示:

WARNING: [pool www] child 21765 exited on signal 11 (SIGSEGV) after 47.779352 seconds from start

内核core dump输出:

...

Core was generated by `php-fpm: pool www                                                             '.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f10e829f060 in igbinary_serialize_ex (ret=0x7ffe09d032c0, ret_len=0x10, z=0x7f10ed818db0,
    memory_manager=0x0) at /data/src/igbinary7/igbinary.c:433
433             *ret_len = igsd.buffer_size - 1;
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.5-7.el6_0.x86_64 cyrus-sasl-lib-2.1.23-15.el6_6.2.x86
_64 glibc-2.12-1.166.el6_7.3.x86_64 libgcc-4.4.7-16.el6.x86_64 libidn-1.18-2.el6.x86_64 libmcrypt-2.5.8-9.el6.x86_64 lib
png-1.2.49-2.el6_7.x86_64 libstdc++-4.4.7-16.el6.x86_64 nspr-4.10.8-2.el6_7.x86_64 nss-3.19.1-5.el6_7.x86_64 nss-softokn
-freebl-3.14.3-23.el6_7.x86_64 nss-util-3.19.1-2.el6_7.x86_64 openldap-2.4.40-7.el6_7.x86_64 zlib-1.2.3-29.el6.x86_64

已经附加到issue后面了。继续等待官方回复,希望给力啊。


989175670dd23483c4ca4ebaec88e39dWordPress Object Cache使用Memcached扩展,现在已经不再报错了。奇怪,难道真有所谓旧数据?!问题是重启过memcache和php的。

msgpack还是被弃用了。。囧。感觉不大用得上。而且最少扩展才能排查出问题来。

说了这么多不好的,说点好的,PHP7性能确实大大地提高了,而且内存占用小了。

PS:以上因为在生产环境,所以没安装gdb所需的debuginfo组件。

最后最后,希望不要再见到Segmentation fault了。

转载请注明转自:kn007的个人博客的《PHP7莫名其妙的问题

donate
有所帮助?

Comments

31 Comments立即评论
  1. LV5回复

    sofa!!! 第一次这么快 :shock:

    1. MOD回复

      @小可: 早起的鸟

    2. LV5回复

      @kn007: 在上班 :cry:

    3. MOD回复

      @小可: 辛苦辛苦,多留言看看,还会不会触发奔溃咧。

    4. LV5回复

      @kn007: 测试2:今天宠儿也起的比较早

    5. LV5回复

      @kn007: 测试3:所以今年早起的鸟儿有虫吃

    6. LV5回复

      @kn007: 测试4:但是不知道这虫儿好吃不好吃

    7. LV5回复

      @kn007: 虫儿说:貌似崩溃不多,很少碰到

    8. MOD回复

      @小可: 谢谢,不是应该是鸟儿说么 :???:

    9. MOD回复

      @小可: 确定不是sendmail_path的问题。wp_mail的问题,要一层层拨开。。或者出现问题,找鸟哥定位问题。

    10. MOD回复

      @kn007: sendmail_path一加回去就会偶尔崩溃,真是令人郁闷。

  2. :roll: 新年快乐!话说昨天访问的时候还提示访问量过大,是不是折腾这个的原因

    1. MOD回复

      @咕噜噜: 崩溃了,就会提示访问量过大 :mrgreen: 我忽悠人的。

    2. @kn007: 太机智了。。不过试了下php7还真是快,只是自己玩儿崩了,又懒得弄了,不知道网站拖延到什么时候才能恢复 :sad:

    3. MOD回复

      @咕噜噜: 现在php7就是有些奇怪的小问题,但是总体提升杠杠滴

  3. LV2回复

    我的没敢开huge page
    :twisted:

    1. MOD回复

      @穹庐: 无论你怎么编译,只要系统存在hugepage,php7就会去用。令人抓急,我另外一个程序要用hugepage,被php7这么搞,反而不能把内核的hugepage开起来了。郁闷。

  4. 回复

    php7?表示我不用~~~

    1. MOD回复
  5. 还没试过php7 官方说php7性能可以和hhvm相媲美 有空去折腾折腾。

    1. MOD回复

      @技术拉近你我: 还不错。

  6. LV1回复

    请问PHP7对于普通的wordpress站点 有什么不兼容的地方吗?

    1. MOD回复

      @Summer: 没有,我就是php7+wordpress4,看你自己主题有没有过期语法,没有就没问题。起码wp自带的主题都是没问题的。

    2. LV1回复

      @kn007: 我的站点目前是php5.X+wordpress4 你觉得升级有没有必要了? 还是能稳定在了升级,我现在用的缓存插件。还是挺快的。

    3. MOD回复

      @Summer: php7提升100%以上,另外现在已经是稳定的了。上述问题,php7的都解决了。php7比php5省内存(这点很重要),处理快,能耐更多的并发攻击。一切看个人意愿。

    4. LV1回复

      @kn007: 我单独建了一个PHP7的环境测试了一下 目前没有任何问题。可以升级。 :arrow: :arrow: :arrow: 3Q.3Q!

    5. MOD回复

      @Summer: 不客气

  7. 回复

    PHP Warning: Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory (12) in Unknown on line 0。

    我也出现这个问题了,

    1. MOD回复

      @海盗湾: 请用最新版,出现这个是没有给到hugepage,或者hugepage过小。

    2. 回复

      @kn007: 博主,我的1G内存可以启用huge_code_pages吗?我用的PHP是7.0.6版本

    3. MOD回复

      @海盗湾: 你跑应用后,空闲内存多少先?
      一般lnmp剩下的可用内存并不多,没什么必要。

icon_wink.gificon_neutral.gificon_mad.gificon_twisted.gificon_smile.gificon_eek.gificon_sad.gificon_rolleyes.gificon_razz.gificon_redface.gificon_surprised.gificon_mrgreen.gificon_lol.gificon_idea.gificon_biggrin.gificon_evil.gificon_cry.gificon_cool.gificon_arrow.gificon_confused.gificon_question.gificon_exclaim.gif