cphalcon: Volt causing crash of PHP-FPM with compileAlways=true - SIGBUS 7 with error zend_language_scanner.c: no such file or directory
Volt causes PHP-FPM to crash, forcing Nginx to go on 502 Error if those two conditions are applied:
- Volt is configured with
compileAlways=true - PHP-FPM is configured with option
pm.max_children> 1, in order to letting it accepting more than 1 request at a time
When we experienced this issue we opened a thread on Phalcon Forum. See: https://forum.phalconphp.com/discussion/14869/php5fpm-on-nginx-crash-zendzendlanguagescannerc-no-such-file-or-
How to reproduce:
- Set PHP-FPM with option
pm.max_childrenwith a value greater than 1 (2, 10, 500…) - Configure Volt with option
compileAlways=true - Turn on core dumps for PHP-FPM.
- Open a lot of pages in the application at the same time from at least 2 clients (in order to force PHP-FPM to serve more than 1 request at the same time).
Expected results:
- Some of the requests will fail, causing Nginx to throw 502 Error.
- Nginx error log will contain something similar to:
[error] 8428#0: *368771 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: xxxxxx.xxxxxxxxx.xxx, request: "POST /abc/def_ghi HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxxxxx.xxxxxxxxx.xxx", referrer: "https://xxxxxx.xxxxxxxxx.xxx/abc"
- PHP-FPM error log will contain something similar to:
WARNING: [pool www] child 1391 exited on signal 7 (SIGBUS) after 59.871442 seconds from start
WARNING: [pool www] child 12836 exited on signal 7 (SIGBUS - core dumped) after 560.364868 seconds from start
WARNING: [pool www] child 10874 exited on signal 7 (SIGBUS - core dumped) after 38.964131 seconds from start
- The core dump of PHP-FPM will contain the error:
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by 'php-fpm: pool www'.
Program terminated with signal SIGBUS, Bus error.
#0 lex_scan (zendlval=zendlval@entry=0x7fff14a7b0b8) at Zend/zend_language_scanner.c:1082
1082 Zend/zend_language_scanner.c: no such file or directory.
This bug is related to: https://github.com/phalcon/cphalcon/issues/1949 https://github.com/phalcon/cphalcon/issues/11507
- Why did we have to get to the core dumps to discover the problem?
- Why isn’t Volt throwing an Exception when it can’t compile a template?
- It obviously is a bug: why those two bugs were ignored?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 37 (25 by maintainers)
As you see this simple code:
Is causing the same problem too, without any library or template engine.
Okay script to reproduce without phalcon:
Can be closed @andresgutierrez @klay @tobispace i’m pretty sure that we can’t do anything to fix this. It’s creating same core dump with same line.
You can only create a new bug on https://bugs.php.net
We’ve had the same problem on our production system during load tests with jmeter by accidentally setting compileAlways to true. Took some hours to figure out the reason.
@Jurigag yes, I do agree 😃 It was just for anyone who ends up here, to help a bit investigating what’s the issue, because it’s not Phalcon.
Yea, i mean my lock which is just manual stuff works fine, no seg fault at all. But not sure how to make it to work correctly so if we can’t read/write whatever then we will use latest available view. But tbh - i would just close this and don’t care abou it, on production we wont use compileAlways anyway and on development we will never have so many requests which will cause this thing to happen.
Well everyone and you should always use it even on development ? Opcache is speeding up an application by few times.
Beacause it’s doing similar stuff i posted. It’s just php bug which never be fixed because it’s 3rd party related, like some security, memory stuff, filesystem etc.
Just most likely what is happening there - another saving is trying to be done when saving is already in process so it’s impossible to save file - this is why you have sig bus error. I guess in php itself it could be somehow fixed, but i don’t know, im just guessing.
Looks like this. Keep in mind there is no seg fault without opcache.
Failing in this place:
@stamster We are working the same way and the 502 were experienced only on production env. Then, we try a “deep” DOS in our local servers simulating a huge amount of concurrent requests at the same time and we reproduced the infamous SIGBUS 7.