-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault with Phalcon 2 #10140
Comments
If you can share the code that produces the segfault we could try to fix it |
Running gdb bt on a core dump produced the below (when not in dev mode) I will note the application seems to sporadically crash when calling \Phalcon\Config::merge ... I have overridden this class, but not the merge function. #0 zend_call_function (fci=0x7fffdea05a90, fci_cache=0x7fffdea05a60) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_execute_API.c:816 |
I would also note I have tried disabling XDebug with the same effect |
Just posting for posterity, but the below code causes segfaults for me intermittently: namespace Cloud\Core\Library;
//use Cloud;
Class Config extends \Phalcon\Config{
}
$cfg = new \Cloud\Core\Library\Config(array(
'foo' => 'bar'
));
$cfg2 = new \Phalcon\Config(array(
));
$cfg->merge($cfg2);
echo "GOT HERE"; |
It seems a constant propagation optimisation made by GCC is causing this, that's why install-test (which has compiler optimisations disabled) does not show the problem. Can you please compile from ext/ in the 2.0.x branch? |
Hi Andres, Thanks so much for your time! Unfortunately I'm still getting the same The same sample script I sent you is still causing me issues. On Wed, Apr 22, 2015 at 10:28 PM, Andres Gutierrez <notifications@github.com
|
👍
|
I've also verified it seems to be a php-fpm issue |
Same for me, running my code with php-fpm 5.5.x gives me a segfault. After switching to php-fpm 5.6.x everything works fine again. |
Apache: |
I'm investigating this issue again |
Could you please guys compile again from the 2.0.x branch? Just added a possible fix there |
|
@andresgutierrez Is possible provide additional info from binary files?
Sorry, I'm newbie in debugging |
@andresgutierrez It works, but partially. The error goes away after merge #10217 |
@sergeyklay Do you have the Redis extension enabled? @KorsaR-ZN What in your PR makes this work? |
@andresgutierrez Sorry, it's works! My PR fix errors, empty columns, not implementation "distinct",
SQL:
|
|
$ git status
# On branch 2.0.x
# Your branch is up-to-date with 'origin/2.0.x'.
# nothing to commit, working directory clean $ git fetch
# Nothing $ git rebase origin/2.0.x
# Current branch 2.0.x is up to date. Lets go $ zephir fullclean
# [sudo] password for klay: $ zephir build
# Preparing for PHP compilation...
# Preparing configuration file...
# Compiling...
# Installing...
# Extension installed!
# Don't forget to restart your web server
# /usr/local/bin/zephir: line 39: 3959 Segmentation fault (core dumped) php $ZEPHIRDIR/compiler.php $* $ zephir stubs
# Generating stubs...
# /usr/local/bin/zephir: line 39: 12619 Segmentation fault (core dumped) php $ZEPHIRDIR/compiler.php $* Okay. I know that this commit 258bf0d was added new method $ php -r 'echo \Phalcon\Version::get() . PHP_EOL;'
# 2.0.1 $ php -r 'var_dump((new ReflectionClass("\Phalcon\Db\Dialect"))->hasMethod("escape"));'
# bool(true)
So, very well. But I'm confused about segfaults which is described above $ zephir version
# 0.6.2a |
@andresgutierrez now I unable to build new Phalcon. another machine (debian) ... fetching new version from 2.0.x branch ... $ zephir fullclean && zephir build
# nothing $ sudo /etc/init.d/php-fpm restart
# Gracefully shutting down php-fpm . done
# Starting php-fpm done $ php -r 'echo \Phalcon\Version::get() . PHP_EOL;'
# 2.0.1
```sh
$ php -r 'var_dump((new ReflectionClass("\Phalcon\Db\Dialect"))->hasMethod("escape"));'
# bool(false) Oops! $ zephir version
0.6.2a $ php -v
PHP 5.5.22 (cli) (built: Feb 20 2015 07:55:27)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies $ phpize -v
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212 $ php -m
[PHP Modules]
apc
apcu
bcmath
bz2
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gearman
gmp
hash
iconv
imap
json
libxml
mbstring
mcrypt
memcache
memcached
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
phalcon
Phar
posix
redis
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache $ lsb_release --all
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy $ gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ re2c --version
re2c 0.13.5 $ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu $ clang --version
Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix $ autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille. $ automake --version
automake (GNU automake) 1.11.6
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Tom Tromey <tromey@redhat.com>
and Alexandre Duret-Lutz <adl@gnu.org>. $ aptitude search libpcre3 | grep 'i ' | awk -F'- ' '{print $1}'
i A libpcre3
i libpcre3-dev Okay. Let's go just build it: $ cd build/
$ sudo ./install
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
Cleaning..
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for icc... no
checking for suncc... no
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20121212
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable phalcon... yes, shared
checking whether HAVE_BUNDLED_PCRE is declared... yes
checking for ext/pcre/php_pcre.h... yes
checking whether HAVE_JSON is declared... yes
checking for ext/json/php_json.h... yes
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
/bin/bash /home/wdata/cphalcon/build/64bits/libtool --mode=compile gcc -I. -I/home/wdata/cphalcon/build/64bits -DPHP_ATOM_INC -I/home/wdata/cphalcon/build/64bits/include -I/home/wdata/cphalcon/build/64bits/main -I/home/wdata/cphalcon/build/64bits -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden -c /home/wdata/cphalcon/build/64bits/phalcon.zep.c -o phalcon.lo
mkdir .libs
gcc -I. -I/home/wdata/cphalcon/build/64bits -DPHP_ATOM_INC -I/home/wdata/cphalcon/build/64bits/include -I/home/wdata/cphalcon/build/64bits/main -I/home/wdata/cphalcon/build/64bits -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden -c /home/wdata/cphalcon/build/64bits/phalcon.zep.c -fPIC -DPIC -o .libs/phalcon.o
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:111997:3: error: conflicting types for ‘YYMINORTYPE’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94504:3: note: previous declaration of ‘YYMINORTYPE’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112003:0: warning: "YYNSTATE" redefined [enabled by default]
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94510:0: note: this is the location of the previous definition
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112004:0: warning: "YYNRULE" redefined [enabled by default]
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94511:0: note: this is the location of the previous definition
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112005:0: warning: "YYERRORSYMBOL" redefined [enabled by default]
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94512:0: note: this is the location of the previous definition
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112058:21: error: redefinition of ‘yy_action’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94565:21: note: previous definition of ‘yy_action’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112281:19: error: redefinition of ‘yy_lookahead’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94631:19: note: previous definition of ‘yy_lookahead’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112504:0: warning: "YY_SHIFT_USE_DFLT" redefined [enabled by default]
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94697:0: note: this is the location of the previous definition
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112505:14: error: redefinition of ‘yy_shift_ofst’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94698:14: note: previous definition of ‘yy_shift_ofst’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112541:0: warning: "YY_REDUCE_USE_DFLT" redefined [enabled by default]
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94725:0: note: this is the location of the previous definition
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112542:14: error: redefinition of ‘yy_reduce_ofst’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94726:14: note: previous definition of ‘yy_reduce_ofst’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112578:21: error: redefinition of ‘yy_default’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94753:21: note: previous definition of ‘yy_default’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112643:8: error: redefinition of ‘struct yyStackEntry’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94809:8: note: originally defined here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112650:29: error: conflicting types for ‘yyStackEntry’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94816:29: note: previous declaration of ‘yyStackEntry’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112654:8: error: redefinition of ‘struct yyParser’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94820:8: note: originally defined here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112660:25: error: conflicting types for ‘yyParser’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:94826:25: note: previous declaration of ‘yyParser’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:112892:13: error: conflicting types for ‘yy_destructor’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95052:13: note: previous definition of ‘yy_destructor’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113033:12: error: conflicting types for ‘yy_pop_parser_stack’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95198:12: note: previous definition of ‘yy_pop_parser_stack’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113061:12: error: conflicting types for ‘yy_find_shift_action’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95226:12: note: previous definition of ‘yy_find_shift_action’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113097:12: error: conflicting types for ‘yy_find_reduce_action’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95262:12: note: previous definition of ‘yy_find_reduce_action’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113119:13: error: conflicting types for ‘yy_shift’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95284:13: note: previous definition of ‘yy_shift’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113163:3: error: conflicting types for ‘yyRuleInfo’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95328:3: note: previous definition of ‘yyRuleInfo’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113311:13: error: conflicting types for ‘yy_accept’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:96423:13: note: previous definition of ‘yy_accept’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:113313:13: error: conflicting types for ‘yy_reduce’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:95472:13: note: previous definition of ‘yy_reduce’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:114204:13: error: conflicting types for ‘yy_parse_failed’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:96330:13: note: previous definition of ‘yy_parse_failed’ was here
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:114219:13: error: conflicting types for ‘yy_syntax_error’
/home/wdata/cphalcon/build/64bits/phalcon.zep.c:96345:13: note: previous definition of ‘yy_syntax_error’ was here
make: *** [phalcon.lo] Error 1 What other information can I provide? |
Same here. O2 build segmentation fault on newest 2.0.x (2.0.0 is ok). O0 is fine. Backtrace for O2 g3:
|
@andresgutierrez Any idea? |
@sergeyklay Try disabling the redis extension before run |
@sergeyklay Please compile from ext/ cd ext/
sudo ./install |
@andresgutierrez I disabled redis, deleted current phalcon:
and then run:
(note: after build nothing - no messages, silent completion. build is done?) and then enabled redis and run: cd ext/
sudo ./install
It seems new version not built |
@andresgutierrez fantastic.. i removed local repo, cloned aggain with your current changes (1dd968e), do not disabled redis: $ zephir build
$ cd ext/
$ sudo ./install
$ sudo cp ext/modules/phalcon.so /usr/local/lib/php/extensions/no-debug-non-zts-20121212/
$ php -r 'var_dump((new ReflectionClass("\Phalcon\Db\Dialect"))->hasMethod("escape"));'
bool(true) fine! |
@andresgutierrez is this still for the segfault issue? I compiled from 2.0.x ... am now seeing segfault when calling $dispatcher->dispatch() in my front controller (I don't use the standard Phalcon App class). Below is core dump: Core was generated by `php-fpm: pool www '. |
Same issue when trying to run phalcon on a Debian 8 (Jessie), with PHP 5.6.7. Phalcon branch is 2.0.x, built one hour ago. Here's a backtrace:
It seems to be linked to the Annotation Parser (I'm using APC, so it's APCu on PHP 5.6+). Line of zend_alloc.c issue: https://github.com/php/php-src/blob/PHP-5.6.7/Zend/zend_alloc.c#L2104 |
Found a workaround, but I don't know if it will fix the other Segfaults above. This one crashes:
This one doesn't:
Code to raise the error:
Hum, seems to be linked to this bug: #6784 Edit: just built from the 2.0.0 branch: everything's fine so far! |
@dugwood Right now I use in my Cli App
foreach ($methodAnnotations as $action => $collection) {
if ($collection->has('....')) {
// logic
}
} and annotations like: /**
* Get common action name
*
* @return string
* @DoNotCover
*/ All works fine. Latest Phalcon build (2.0.x) P.S. Of course annotation parser parses my methods without annotation or phpdoc at all |
Sure, that's because you're on PHP 5.5, not 5.6. And I thought that was linked to your issue, and it's not. Just so you know, I've found this easy way to generate a backtrace:
Also, why are you using PHP 5.5 on Debian oldstable? It should be 5.4 according to https://packages.debian.org/fr/wheezy/php5. Homemade release? |
👍 thanks About php on debian: our admin compiled this version for all our vds |
@dugwood Phalcon just added the annotations fix yesterday. It fixed 2 of my annotation issues ... can you rebuild from latest 2.0.x and see if the issue still exists? |
@virgofx thanks for the heads up, just built it, and no more crash :-) I'll stick to the 2.0.0 for now however, waiting for the next stable release. |
Current stable is 2.0.1 |
No more crash :) |
Hi,
I upgraded to Phalcon 2 today and spent a while trying to solve an issue related to the Php5 fpm process randomly segfaulting (no info, just a 502 from nginx and a segfault message in /var/log/syslog)
I found another thread that recommended running cphalcon/ext/install-test ... to my amazement I am no longer receiving segfaults.
When I was, I could not find any problems when running with gdb, so I can't add any info to what's going on.
What does install-test do? Is this some type of debug mode? Will it be a performance issue to run the app in debug mode?
The text was updated successfully, but these errors were encountered: