Skip to content
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

Closed
cadencelabs-master opened this issue Apr 22, 2015 · 39 comments
Closed

Segfault with Phalcon 2 #10140

cadencelabs-master opened this issue Apr 22, 2015 · 39 comments

Comments

@cadencelabs-master
Copy link

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?

@andresgutierrez
Copy link
Contributor

If you can share the code that produces the segfault we could try to fix it

@cadencelabs-master
Copy link
Author

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
#1 0x00007faba6201142 in zephir_call_user_function.constprop () from /usr/lib/php5/20121212/phalcon.so
#2 0x00007faba6205646 in zephir_call_class_method_aparams () from /usr/lib/php5/20121212/phalcon.so
#3 0x00007faba61fb8ac in zim_Phalcon_Config_merge () from /usr/lib/php5/20121212/phalcon.so
#4 0x00000000006dd65b in dtrace_execute_internal (execute_data_ptr=, fci=, return_value_used=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:97
#5 0x00007fabaed97612 in xdebug_execute_internal (current_execute_data=0x7fabb1a873a8, fci=0x0, return_value_used=0) at /tmp/pear/temp/xdebug/xdebug.c:1649
#6 0x000000000079d6b5 in zend_do_fcall_common_helper_SPEC (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:552
#7 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a873a8) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#8 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#9 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a873a8) at /tmp/pear/temp/xdebug/xdebug.c:1526
#10 0x000000000079dd00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fabb1a87228) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
#11 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a87228) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#12 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#13 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a87228) at /tmp/pear/temp/xdebug/xdebug.c:1526
#14 0x000000000079dd00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fabb1a870d0) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
#15 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a870d0) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#16 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#17 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a870d0) at /tmp/pear/temp/xdebug/xdebug.c:1526
#18 0x000000000079dd00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fabb1a86f78) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
#19 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a86f78) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#20 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#21 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a86f78) at /tmp/pear/temp/xdebug/xdebug.c:1526
#22 0x000000000079dd00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fabb1a86e70) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
#23 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a86e70) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#24 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#25 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a86e70) at /tmp/pear/temp/xdebug/xdebug.c:1526
#26 0x000000000079dd00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fabb1a86d38) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
#27 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a86d38) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#28 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#29 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a86d38) at /tmp/pear/temp/xdebug/xdebug.c:1526
#30 0x000000000079dd00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fabb1a86c58) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:584
#31 0x00000000007173e8 in execute_ex (execute_data=0x7fabb1a86c58) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_vm_execute.h:363
#32 0x00000000006dd559 in dtrace_execute_ex (execute_data=) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_dtrace.c:73
#33 0x00007fabaed96da2 in xdebug_execute_ex (execute_data=0x7fabb1a86c58) at /tmp/pear/temp/xdebug/xdebug.c:1526
#34 0x00000000006eefe0 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /build/buildd/php5-5.5.9+dfsg/Zend/zend.c:1316
#35 0x000000000068eec5 in php_execute_script (primary_file=primary_file@entry=0x7fffdea09180) at /build/buildd/php5-5.5.9+dfsg/main/main.c:2506
#36 0x0000000000463b00 in main (argc=, argv=) at /build/buildd/php5-5.5.9+dfsg/sapi/fpm/fpm/fpm_main.c:1933

@cadencelabs-master
Copy link
Author

I would also note I have tried disabling XDebug with the same effect

@cadencelabs-master
Copy link
Author

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";

@andresgutierrez
Copy link
Contributor

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?

@cadencelabs-master
Copy link
Author

Hi Andres,

Thanks so much for your time! Unfortunately I'm still getting the same
behavior after recompiling from 2.0.x. Have verified 2.0.1 is the version
for phalcon from phpinfo()

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

wrote:

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?


Reply to this email directly or view it on GitHub
#10140 (comment).

@KorsaR-ZN
Copy link
Contributor

👍

  • Nginx + php-fpm + Phalcon (2.0.0 or 2.0.x) - segfault (random time)
  • Nginx + apache2 + Phalcon (2.0.0 or 2.0.x) - it work
Core was generated by `php-fpm: pool dev-test                                             '.
Program terminated with signal 11, Segmentation fault.
#0  zend_call_function (fci=0x7fffcfdcf0f0, fci_cache=0x7fffcfdcf0c0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:811
811     /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c: No such file or directory.
(gdb) bt
#0  zend_call_function (fci=0x7fffcfdcf0f0, fci_cache=0x7fffcfdcf0c0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:811
#1  0x00007f19a8a6b11d in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#2  0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#3  0x00007f19a895cb12 in zim_Phalcon_Db_Dialect_select () from /usr/src/phalcon-core/ext/modules/phalcon.so
#4  0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#5  0x00000000006c237e in zend_call_function (fci=0x7fffcfdcf740, fci_cache=0x7fffcfdcf710) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:954
#6  0x00007f19a8a6b220 in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#7  0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#8  0x00007f19a883bc79 in zim_Phalcon_Mvc_Model_Query__executeSelect () from /usr/src/phalcon-core/ext/modules/phalcon.so
#9  0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#10 0x00000000006c237e in zend_call_function (fci=0x7fffcfdcfdd0, fci_cache=0x7fffcfdcfda0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:954
#11 0x00007f19a8a6b11d in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#12 0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#13 0x00007f19a8956d0e in zim_Phalcon_Mvc_Model_Query_execute () from /usr/src/phalcon-core/ext/modules/phalcon.so
#14 0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#15 0x00000000006c237e in zend_call_function (fci=0x7fffcfdd02c0, fci_cache=0x7fffcfdd0290) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:954
#16 0x00007f19a8a6b220 in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#17 0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#18 0x00007f19a895dec7 in zim_Phalcon_Mvc_Model_findFirst () from /usr/src/phalcon-core/ext/modules/phalcon.so
#19 0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#20 0x0000000000780ccb in zend_do_fcall_common_helper_SPEC (execute_data=0x7f19b79cf4c0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_vm_execute.h:552
#21 0x000000000073f718 in execute_ex (execute_data=0x7f19b79cf4c0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_vm_execute.h:363
#22 0x00000000006bff1d in dtrace_execute_ex (execute_data=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:73
#23 0x00000000006c2231 in zend_call_function (fci=0x7fffcfdd08c0, fci_cache=0x7f19b7a028b8) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:934
#24 0x00007f19a8a6b220 in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#25 0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#26 0x00007f19a8821061 in zim_Phalcon_Events_Manager_fireQueue () from /usr/src/phalcon-core/ext/modules/phalcon.so
#27 0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#28 0x00000000006c237e in zend_call_function (fci=0x7fffcfdd0e20, fci_cache=0x7fffcfdd0df0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:954
#29 0x00007f19a8a6b11d in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#30 0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#31 0x00007f19a8820450 in zim_Phalcon_Events_Manager_fire () from /usr/src/phalcon-core/ext/modules/phalcon.so
#32 0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#33 0x00000000006c237e in zend_call_function (fci=0x7fffcfdd12f0, fci_cache=0x7fffcfdd12c0) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:954
#34 0x00007f19a8a6b220 in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#35 0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#36 0x00007f19a881da5f in zim_Phalcon_Dispatcher_dispatch () from /usr/src/phalcon-core/ext/modules/phalcon.so
#37 0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#38 0x00000000006c237e in zend_call_function (fci=0x7fffcfdd1860, fci_cache=0x7fffcfdd1830) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:954
#39 0x00007f19a8a6b220 in zephir_call_user_function.constprop.662.3053 () from /usr/src/phalcon-core/ext/modules/phalcon.so
#40 0x00007f19a8a7240e in zephir_call_class_method_aparams () from /usr/src/phalcon-core/ext/modules/phalcon.so
#41 0x00007f19a8958d07 in zim_Phalcon_Mvc_Application_handle () from /usr/src/phalcon-core/ext/modules/phalcon.so
#42 0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#43 0x0000000000780ccb in zend_do_fcall_common_helper_SPEC (execute_data=0x7f19b79cf330) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_vm_execute.h:552
#44 0x000000000073f718 in execute_ex (execute_data=0x7f19b79cf330) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_vm_execute.h:363
#45 0x00000000006bff1d in dtrace_execute_ex (execute_data=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:73
#46 0x00000000006d1ba9 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend.c:1327
#47 0x000000000066f8b2 in php_execute_script (primary_file=primary_file@entry=0x7fffcfdd4210) at /usr/src/php5.5/source/dotdeb-php5/main/main.c:2525
#48 0x0000000000432cc2 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/php5.5/source/dotdeb-php5/sapi/fpm/fpm/fpm_main.c:1953
Core was generated by `php-fpm: pool dev-test                                              '.
Program terminated with signal 11, Segmentation fault.
#0  zend_call_function (fci=0x7fffcfdd1750, fci_cache=0x7fffcfdd1720)
    at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:811
811     /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c: No such file or directory.
(gdb) bt
#0  zend_call_function (fci=0x7fffcfdd1750, fci_cache=0x7fffcfdd1720)
    at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_execute_API.c:811
#1  0x00007f19a8a6b11d in zephir_call_user_function.constprop.662.3053 ()
   from /usr/src/phalcon-core/ext/modules/phalcon.so
#2  0x00007f19a8a7240e in zephir_call_class_method_aparams ()
   from /usr/src/phalcon-core/ext/modules/phalcon.so
#3  0x00007f19a895cb12 in zim_Phalcon_Db_Dialect_select ()
   from /usr/src/phalcon-core/ext/modules/phalcon.so
#4  0x00000000006c0049 in dtrace_execute_internal (execute_data_ptr=<optimized out>,
    fci=<optimized out>, return_value_used=<optimized out>)
    at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:97
#5  0x0000000000780ccb in zend_do_fcall_common_helper_SPEC (execute_data=0x7f19b79cf330)
    at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_vm_execute.h:552
#6  0x000000000073f718 in execute_ex (execute_data=0x7f19b79cf330)
    at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_vm_execute.h:363
#7  0x00000000006bff1d in dtrace_execute_ex (execute_data=<optimized out>)
    at /usr/src/php5.5/source/dotdeb-php5/Zend/zend_dtrace.c:73
#8  0x00000000006d1ba9 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0,
    file_count=file_count@entry=3) at /usr/src/php5.5/source/dotdeb-php5/Zend/zend.c:1327
#9  0x000000000066f8b2 in php_execute_script (primary_file=primary_file@entry=0x7fffcfdd4210)
    at /usr/src/php5.5/source/dotdeb-php5/main/main.c:2525
#10 0x0000000000432cc2 in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/php5.5/source/dotdeb-php5/sapi/fpm/fpm/fpm_main.c:1953

@cadencelabs-master
Copy link
Author

I've also verified it seems to be a php-fpm issue

@michanismus
Copy link
Contributor

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.

@KorsaR-ZN
Copy link
Contributor

@michanismus
👍

@tmihalik
Copy link
Contributor

Apache:
[Thu Apr 30 11:00:06.383105 2015] [core:notice] [pid 1666] AH00051: child pid 1721 exit signal Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump

@andresgutierrez
Copy link
Contributor

I'm investigating this issue again

@andresgutierrez
Copy link
Contributor

Could you please guys compile again from the 2.0.x branch? Just added a possible fix there

@sergeyklay
Copy link
Contributor

$ git fetch && git rebase origin/2.0.x
$ zephir fullclean
$ zephir build
Zephir\CompilerException: Unknown type int in /home/klay/projects/c/cphalcon/phalcon/security.zep on line 174

        let variant = "5";
    ---------------------^

/usr/local/bin/zephir: line 39: 11463 Segmentation fault      (core dumped) php $ZEPHIRDIR/compiler.php $*
$ cat /var/log/kern.log | grep php
May  1 19:48:28 edge kernel: [113573.038734] php[11463]: segfault at ffffffff02fef02f ip 00007f40f25bb0d5 sp 00007ffc17ec83b0 error 5 in libc-2.19.so[7f40f253c000+1bb000]

@sergeyklay
Copy link
Contributor

Sorry, I do not know how to get the report from this.

ubuntu_044

@sergeyklay
Copy link
Contributor

@andresgutierrez Is possible provide additional info from binary files?

$ ls -l /var/crash/
total 110056
-rw-r----- 1 klay     whoopsie 20870099 May  1 19:50 _usr_bin_php5.1000.crash

Sorry, I'm newbie in debugging

@KorsaR-ZN
Copy link
Contributor

@andresgutierrez It works, but partially. The error goes away after merge #10217

@andresgutierrez
Copy link
Contributor

@sergeyklay Do you have the Redis extension enabled?

@KorsaR-ZN What in your PR makes this work?

@KorsaR-ZN
Copy link
Contributor

@andresgutierrez Sorry, it's works!
I forgot restart php-fpm. :)

My PR fix errors, empty columns, not implementation "distinct",
example:

var_dump(Robots::count(array('distinct' => 'type')));

SQL:

SELECT `` FROM `robots`

@andresgutierrez
Copy link
Contributor

@KorsaR-ZN 👍

@sergeyklay
Copy link
Contributor

@andresgutierrez

$ php -m | grep redis
redis

@sergeyklay
Copy link
Contributor

@andresgutierrez.

$ 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 Phalcon\Db\Dialect::escape.

$ 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

@sergeyklay
Copy link
Contributor

@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?

@patrick-zippenfenig
Copy link
Contributor

Same here. O2 build segmentation fault on newest 2.0.x (2.0.0 is ok). O0 is fine. Backtrace for O2 g3:

#0  zephir_make_fcall_info_key (result=0xbfb59bec, length=0x5, obj_ce=obj_ce@entry=0xbfb59bec, type=type@entry=3216350184, info=0x0) at /home/vagrant/cphalcon/ext/kernel/fcall.c:265
#1  0xb570b9c0 in zephir_call_user_function (object_pp=object_pp@entry=0x0, obj_ce=obj_ce@entry=0x0, type=type@entry=zephir_fcall_function, function_name=function_name@entry=0x0, retval_ptr_ptr=0xbfb59d54, cache_entry=cache_entry@entry=0xbfb59d38, 
    param_count=param_count@entry=1, params=params@entry=0xbfb59d6c, info=info@entry=0xbfb59cc4) at /home/vagrant/cphalcon/ext/kernel/fcall.c:512
#2  0xb570bdef in zephir_call_func_aparams (return_value_ptr=return_value_ptr@entry=0xbfb59d54, func_name=func_name@entry=0xb59d19d9 "strval", func_length=func_length@entry=6, cache_entry=cache_entry@entry=0xbfb59d38, param_count=param_count@entry=1, 
    params=params@entry=0xbfb59d6c) at /home/vagrant/cphalcon/ext/kernel/fcall.c:665
#3  0xb5775235 in zim_Phalcon_Config___construct (ht=1, return_value=0xb6e314a8, return_value_ptr=0xb6e0f2a8, this_ptr=0xb6e2edf8, return_value_used=0) at /home/vagrant/cphalcon/ext/phalcon/config.zep.c:92
#4  0x0840f1a6 in execute_internal ()
#5  0x08353ec3 in dtrace_execute_internal ()
#0  zephir_make_fcall_info_key (result=0xbfb59bec, length=0x5, obj_ce=obj_ce@entry=0xbfb59bec, type=type@entry=3216350184, info=0x0) at /home/vagrant/cphalcon/ext/kernel/fcall.c:265
        calling_scope = 0x0
        buf = 0x0
        c = <optimized out>
        l = 0
        len = 0
        hash = 5381
#1  0xb570b9c0 in zephir_call_user_function (object_pp=object_pp@entry=0x0, obj_ce=obj_ce@entry=0x0, type=type@entry=zephir_fcall_function, function_name=function_name@entry=0x0, retval_ptr_ptr=0xbfb59d54, cache_entry=cache_entry@entry=0xbfb59d38, 
    param_count=param_count@entry=1, params=params@entry=0xbfb59d6c, info=info@entry=0xbfb59cc4) at /home/vagrant/cphalcon/ext/kernel/fcall.c:512
        params_ptr = 0xbfb59c2c
        params_array = 0x0
        static_params_array = {0xbfb59d6c, 0x89362c0, 0x8cc2b98, 0x0, 0x832b127, 0xbfb59c7c, 0xb56deab7, 0x24, 0x8cb40c0, 0x14}
        local_retval_ptr = 0x0
        status = <optimized out>
        fci = {size = 3216350332, function_table = 0x833e755, function_name = 0x832a7d4, symbol_table = 0x0, retval_ptr_ptr = 0x832a290, param_count = 1, params = 0xdef32e00, object_ptr = 0x0, no_separation = 192 '\300'}
        fcic = {initialized = 0 '\000', function_handler = 0x1, calling_scope = 0x0, called_scope = 0x1, object_ptr = 0x8cc2b98}
        zephir_globals_ptr = 0xb5a5b460
        fcall_key = 0x0
        fcall_key_len = <optimized out>
        fcall_key_hash = <optimized out>
        temp_cache_entry = 0x0
        old_scope = 0x0
#2  0xb570bdef in zephir_call_func_aparams (return_value_ptr=return_value_ptr@entry=0xbfb59d54, func_name=func_name@entry=0xb59d19d9 "strval", func_length=func_length@entry=6, cache_entry=cache_entry@entry=0xbfb59d38, param_count=param_count@entry=1, 
    params=params@entry=0xbfb59d6c) at /home/vagrant/cphalcon/ext/kernel/fcall.c:665
        status = <optimized out>
        rv = 0x0
        rvp = <optimized out>
        func = <optimized out>
        info = {type = 1, ce = 0x8917ff4, object_ptr = 0x833c971, class_name = 0x0, class_length = -1226644120, func_name = 0xb59d19d9 "strval", func_length = 6}
        __FUNCTION__ = "zephir_call_func_aparams"
#3  0xb5775235 in zim_Phalcon_Config___construct (ht=1, return_value=0xb6e314a8, return_value_ptr=0xb6e0f2a8, this_ptr=0xb6e2edf8, return_value_used=0) at /home/vagrant/cphalcon/ext/phalcon/config.zep.c:92
        params_ = {0xb6e314c4}
        ZEPHIR_LAST_CALL_STATUS = <optimized out>
        _4 = 0x0
        _6 = 0x0
        _1 = 0xb6e2e4ec
        _0 = 0xb6e2e544
        arrayConfig_param = 0xb6e3148c
        key = 0xb6e314c4
        value = 0xb6e2f104
        _2 = <optimized out>
        _3 = 0x0
        _5 = 0x0
        arrayConfig = 0xb6e3148c
#4  0x0840f1a6 in execute_internal ()
No symbol table info available.
#5  0x08353ec3 in dtrace_execute_internal ()

@sergeyklay
Copy link
Contributor

@andresgutierrez Any idea?

@andresgutierrez
Copy link
Contributor

@sergeyklay Try disabling the redis extension before run zephir build

@andresgutierrez
Copy link
Contributor

@sergeyklay Please compile from ext/

cd ext/
sudo ./install

@sergeyklay
Copy link
Contributor

@andresgutierrez I disabled redis, deleted current phalcon:

sudo rm /usr/local/lib/php/extensions/no-debug-non-zts-20121212/phalcon.so

and then run:

zephir fullclean && zephir build

(note: after build nothing - no messages, silent completion. build is done?)

and then enabled redis and run:

cd ext/
sudo ./install
... compiler output omitted ...

(cd .libs && rm -f phalcon.la && ln -s ../phalcon.la phalcon.la)
cp ./.libs/phalcon.so /home/wdata/cphalcon/ext/modules/phalcon.so
cp ./.libs/phalcon.lai /home/wdata/cphalcon/ext/modules/phalcon.la
PATH="$PATH:/sbin" ldconfig -n /home/wdata/cphalcon/ext/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/wdata/cphalcon/ext/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20121212/
Installing header files:          /usr/local/include/php/

$ php -m | grep phalcon
phalcon

$ php -r 'var_dump((new ReflectionClass("\Phalcon\Db\Dialect"))->hasMethod("escape"));'
bool(false)

It seems new version not built

@sergeyklay
Copy link
Contributor

@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!

@cadencelabs-master
Copy link
Author

@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 '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 zend_call_function (fci=0x7fff596f4d20, fci_cache=0x7fff596f4cf0) at /build/buildd/php5-5.5.9+dfsg/Zend/zend_execute_API.c:816
816 /build/buildd/php5-5.5.9+dfsg/Zend/zend_execute_API.c: No such file or directory.

Core was generated by `php-fpm: pool www '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000000000 in ?? ()

@dugwood
Copy link
Contributor

dugwood commented May 7, 2015

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.
Note that opcache is disabled.

Here's a backtrace:

Program received signal SIGSEGV, Segmentation fault.
_zend_mm_free_int (heap=0x7ffff7e98048, p=0x7ffff7e98058) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_alloc.c:2104
2104    /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_alloc.c: Aucun fichier ou dossier de ce type.
(gdb) bt
#0  _zend_mm_free_int (heap=0x7ffff7e98048, p=0x7ffff7e98058) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_alloc.c:2104
#1  0x00007fffec121e97 in phannot_parse_annotations () from /usr/lib/php5/20131226/phalcon.so
#2  0x00007fffec1cdd72 in zim_Phalcon_Annotations_Reader_parse () from /usr/lib/php5/20131226/phalcon.so
#3  0x00000000006dc22a in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_dtrace.c:97
#4  0x00007fffec1f27c0 in zephir_call_function_opt () from /usr/lib/php5/20131226/phalcon.so
#5  0x00007fffec1f5350 in zephir_call_user_function () from /usr/lib/php5/20131226/phalcon.so
#6  0x00007fffec1fc20f in zephir_call_class_method_aparams () from /usr/lib/php5/20131226/phalcon.so
#7  0x00007fffec1e1c04 in zim_Phalcon_Annotations_Adapter_get () from /usr/lib/php5/20131226/phalcon.so
#8  0x00000000006dc22a in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_dtrace.c:97
#9  0x00007fffec1f27c0 in zephir_call_function_opt () from /usr/lib/php5/20131226/phalcon.so
#10 0x00007fffec1f5350 in zephir_call_user_function () from /usr/lib/php5/20131226/phalcon.so
#11 0x00007fffec1fc20f in zephir_call_class_method_aparams () from /usr/lib/php5/20131226/phalcon.so
#12 0x00007fffec1edd26 in zim_Phalcon_Annotations_Adapter_getMethod () from /usr/lib/php5/20131226/phalcon.so
#13 0x00000000006dc22a in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_dtrace.c:97
#14 0x000000000079a320 in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffff7f9e4b0) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_vm_execute.h:560
#15 0x000000000072a370 in execute_ex (execute_data=0x7ffff7f9e4b0) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_vm_execute.h:363
#16 0x00000000006dc0c8 in dtrace_execute_ex (execute_data=0x7ffff7f9e4b0) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_dtrace.c:73
#17 0x00007fffec1f241d in zephir_call_function_opt () from /usr/lib/php5/20131226/phalcon.so
#18 0x00007fffec1f5350 in zephir_call_user_function () from /usr/lib/php5/20131226/phalcon.so
#19 0x00007fffec1fc20f in zephir_call_class_method_aparams () from /usr/lib/php5/20131226/phalcon.so
#20 0x00007fffec101f61 in zim_Phalcon_Events_Manager_fireQueue () from /usr/lib/php5/20131226/phalcon.so
#21 0x00000000006dc22a in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_dtrace.c:97
#22 0x00007fffec1f27c0 in zephir_call_function_opt () from /usr/lib/php5/20131226/phalcon.so
#23 0x00007fffec1f5350 in zephir_call_user_function () from /usr/lib/php5/20131226/phalcon.so
#24 0x00007fffec1fc20f in zephir_call_class_method_aparams () from /usr/lib/php5/20131226/phalcon.so
#25 0x00007fffec1013db in zim_Phalcon_Events_Manager_fire () from /usr/lib/php5/20131226/phalcon.so
#26 0x00000000006dc22a in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=<optimized out>, return_value_used=<optimized out>) at /build/php5-tXxPwu/php5-5.6.7+dfsg/Zend/zend_dtrace.c:97
#27 0x00007fffec1f27c0 in zephir_call_function_opt () from /usr/lib/php5/20131226/phalcon.so
#28 0x00007fffec1f5350 in zephir_call_user_function () from /usr/lib/php5/20131226/phalcon.so
#29 0x00007fffec1fc20f in zephir_call_class_method_aparams () from /usr/lib/php5/20131226/phalcon.so
#30 0x00007fffec106cb7 in zim_Phalcon_Dispatcher_dispatch () from /usr/lib/php5/20131226/phalcon.so

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

@dugwood
Copy link
Contributor

dugwood commented May 7, 2015

Found a workaround, but I don't know if it will fix the other Segfaults above.

This one crashes:

class Fake
{
    /**
     * This is the test function
     */
    public function test()
    {

    }
}

This one doesn't:

class Fake
{
    /**
     * This is the test function
         * @AddedAnEmptyAnnotation
     */
    public function test()
    {

    }
}

Code to raise the error:

$reader = new \Phalcon\Annotations\Reader();
var_dump($reader->parse('Fake'));

Hum, seems to be linked to this bug: #6784

Edit: just built from the 2.0.0 branch: everything's fine so far!

@sergeyklay
Copy link
Contributor

@dugwood Right now I use in my Cli App \Phalcon\Annotations\Adapter\Memory (and Apc):

  • Memory - local machine PHP 5.5.9-1ubuntu4.9 Ubuntu 14.04.2 LTS
  • Apc - production PHP 5.5.22 (with APCu) Debian GNU/Linux 7.8 (wheezy)
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

@dugwood
Copy link
Contributor

dugwood commented May 7, 2015

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:

shell# gdb --args php-cgi /your/script.php
then
(gdb) run
... wait for the crash ...
(gdb) bt

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?

@sergeyklay
Copy link
Contributor

Just so you know, I've found this easy way to generate a backtrace:

👍 thanks

About php on debian: our admin compiled this version for all our vds

@virgofx
Copy link
Contributor

virgofx commented May 11, 2015

@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?

@dugwood
Copy link
Contributor

dugwood commented May 12, 2015

@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.

@sergeyklay
Copy link
Contributor

Current stable is 2.0.1

@tmihalik
Copy link
Contributor

No more crash :)
thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants