-
-
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
[BUG] Phalcon + PHP-FPM = segfault #1000
Comments
Ok, I found what causes an issue. We have custom config adapter, the lines that cause segfault: public function __construct($file, $section = null) {
...
$this->_section = $section; Actually, assigning any class variable ($this->whatever) causes segfault |
Please build a debug version of Phalcon: cd ext
phpize
./configure CFLAGS="-O0 -g3"
make
sudo make install Then enable core dumps: ulimit -c unlimited
echo core > /proc/sys/kernel/core_pattern Then restart php-fpm and try to reproduce the crash. This will generate a core dump. gdb /path/to/php-fpm core At gdb prompt please run
and post the result either here or to pastebin. PS: are you using this commit: 7915b80? |
I've build phalcon version with provided parameters, and enabled dumps, however file is not generated. Can this be because php.ini shows "'--disable-debug" flag in the configure command? I've tried 1.2.2 and master branches |
master will crash, 1.2.2 in theory should not. Can the crash be reproduced with php-cli? |
Ok, I managed to generate dump using this code in CLI mode: class Ini extends \Phalcon\Config {
private $_section;
public function __construct($file, $section = null) {
$this->_section = $section;
}
}
new Ini("test"); backtrace however wasn't informative:
|
OK, I've got the core dump
|
The issue seems to be specific to PHP 5.4 branch |
This patch will fix it: diff --git a/ext/config.c b/ext/config.c
index d076ea9..e60da0c 100644
--- a/ext/config.c
+++ b/ext/config.c
@@ -162,6 +162,7 @@ static void phalcon_config_write_property(zval *object, zval *offset, zval *valu
if (obj->obj.ce->type != ZEND_INTERNAL_CLASS) {
zend_get_std_object_handlers()->write_property(object, offset, value ZLK_CC TSRMLS_CC);
+ return;
}
phalcon_config_write_internal(obj, offset, value TSRMLS_CC);
@@ -176,6 +177,7 @@ static void phalcon_config_write_dimension(zval *object, zval *offset, zval *val
if (obj->obj.ce->type != ZEND_INTERNAL_CLASS) {
zend_get_std_object_handlers()->write_dimension(object, offset, value TSRMLS_CC);
+ return;
}
phalcon_config_write_internal(obj, offset, value TSRMLS_CC);
@@ -239,6 +241,7 @@ static void phalcon_config_unset_property(zval *object, zval *member ZLK_DC TSRM
if (obj->obj.ce->type != ZEND_INTERNAL_CLASS) {
zend_get_std_object_handlers()->unset_property(object, member ZLK_CC TSRMLS_CC);
+ return;
}
phalcon_config_unset_internal(obj, member TSRMLS_CC);
@@ -250,6 +253,7 @@ static void phalcon_config_unset_dimension(zval *object, zval *offset TSRMLS_DC)
if (obj->obj.ce->type != ZEND_INTERNAL_CLASS) {
zend_get_std_object_handlers()->unset_dimension(object, offset TSRMLS_CC);
+ return;
}
phalcon_config_unset_internal(obj, offset TSRMLS_CC);
@@ -261,9 +265,9 @@ static void phalcon_config_unset_dimension(zval *object, zval *offset TSRMLS_DC)
static HashTable* phalcon_config_get_properties(zval* object TSRMLS_DC)
{
HashTable* props = zend_std_get_properties(object TSRMLS_CC);
- phalcon_config_object* obj = fetchPhalconConfigObject(object TSRMLS_CC);
if (!GC_G(gc_active)) {
+ phalcon_config_object* obj = fetchPhalconConfigObject(object TSRMLS_CC);
zend_hash_copy(props, obj->props, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval*));
}
@@ -315,7 +319,11 @@ static zend_object_value phalcon_config_object_ctor(zend_class_entry* ce TSRMLS_
phalcon_config_object* obj = ecalloc(1, sizeof(phalcon_config_object));
zend_object_value retval;
- zend_object_std_init(&(obj->obj), ce TSRMLS_CC);
+ zend_object_std_init(&obj->obj, ce TSRMLS_CC);
+#if PHP_VERSION_ID >= 50400
+ object_properties_init(&obj->obj, ce);
+#endif
+
ALLOC_HASHTABLE(obj->props);
zend_hash_init(obj->props, 0, NULL, ZVAL_PTR_DTOR, 0);
|
I cloned your rep and installed, runs fine, no crashes. |
BTW, if you could verify that Has Many to Many works, that would be great |
I've tried to update from 1.2.0 to next versions. Unfortunately, any version after 1.2.0 causes php-fpm to segfault.
dmesg:
php-fpm[17065]: segfault at 8 ip 00000000005e0fd2 sp 00007fff53f08780 error 4 in php-fpm[400000+315000]
I tracked down the commit after which it occurs.
Still works:
cd01796
Doesn't work:
e29a21a
PHP Version: 5.4.15
The text was updated successfully, but these errors were encountered: