PHP process Sigbus failure, PHP process Sigbus fault _php tutorial

Source: Internet
Author: User
Tags apc php source code

PHP process Sigbus Fault, PHP process Sigbus fault


A sub-station is written by PHP, when the access to the Nginx will occasionally take 502 errors, peak times more frequent, check php-fpm log found a large number of child exited on Signal 7 (Sigbus), and Accesslog in 502 time exactly match , excluding the possibility of overloading the PHP process, and then ruled out the suspicion of APC.

Since the PHP process is dead after receiving the signal, try to grab some coredump to analyze it:

First set the Coredump save path, note that the space is large enough, because the coredump may be more and very large (such as open the APC set 1G, then there will be 1G):

#echo "/tmp/core.%e.%p.%h.%t" >/proc/sys/kernel/core_pattern

Then modify the next ulimit to allow Coredump:

#ulimit-C Unlimited

Restart PHP-FPM. Soon, the/tmp/directory will produce a bunch of coredump files, very good, packaging drag back to the line down analysis it. Remember to close the Coredump and restart the program:

#ulimit-C 0

Analysis Coredump General with GDB is enough, (binary distribution, first install the corresponding debug symbol package):

GDB/USR/LOCAL/PHP/SBIN/PHP-FPM core.php-fpm.10375.php.1365314990

Under the BT command, look at the BackTrace (the specific information forgot to record), found to be hanging in the Lex_scan function, see several coredump, basically are hanging in the lex phase of the function.

I have no research on PHP source code, Google search "php sigbus lex_scan", the first two connections basically gave the answer:

    • https://bugs.php.net/bug.php?id=52752

2010 reported bug, has not close, because it seems that this is not a PHP bug, look closely, there are examples of recurrence, and finally someone found a way to evade.

    • Http://zecrazytux.net/troubleshooting/php-sigbus-crash-prestashop

This gentleman went through the same analysis process as I did, and gave clear reasons and solutions.

Simply said Lex_scan is in the php file parsing, this time just a contained PHP file is rewritten, so tragedy occurs.

To confirm, I used strace to track the execution of the PHP process, and finally caught:

11670 Lstat ("Home", {st_mode=s_ifdir|0755, st_size=4096, ...}) = 0

11670 stat ("/home/www/cache/default.php", {st_mode=s_ifreg|0644, st_size=68579, ...}) = 0

11670---sigbus (Bus error) @ 0 (0)

Source: Http://blog.druggo.org/post/2013/05/02/%E4%B8%80%E4%BE%8Bphp%E8%BF%9B%E7%A8%8B%E7%9A%84SIGBUS%E6%95%85%E9%9A%9C

http://www.bkjia.com/PHPjc/1131690.html www.bkjia.com true http://www.bkjia.com/PHPjc/1131690.html techarticle PHP process Sigbus fault, PHP process Sigbus fault a sub-station is written by PHP, when the access to the Nginx will occasionally take the appearance of 502 errors, peak times more frequent, check php-fpm log found a lot of ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.