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 when running phpunit #1792

Closed
npfedwards opened this issue Dec 26, 2018 · 10 comments
Closed

Segfault when running phpunit #1792

npfedwards opened this issue Dec 26, 2018 · 10 comments
Labels

Comments

@npfedwards
Copy link

npfedwards commented Dec 26, 2018

I'm running phpunit on a phalcon project and getting a segfault on the first test that actually interacts with the extension. I assume it's a Zephir issue given it's a segfault. Here's the trace.

0   php                           	0x000000010341fec9 zend_do_inheritance + 3101
1   php                           	0x00000001033cbb16 do_bind_inherited_class + 112
2   php                           	0x00000001034725b3 ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER + 73
3   php                           	0x0000000103424d32 execute_ex + 98
4   php                           	0x00000001033dcbc5 zend_call_function + 1192
5   php                           	0x00000001032caf1e zif_spl_autoload_call + 405
6   php                           	0x00000001033dcc1f zend_call_function + 1282
7   php                           	0x00000001033dd358 zend_lookup_class_ex + 730
8   php                           	0x00000001033ddb01 zend_fetch_class_by_name + 34
9   php                           	0x000000010347258e ZEND_DECLARE_INHERITED_CLASS_SPEC_CONST_CONST_HANDLER + 36
10  php                           	0x0000000103424d32 execute_ex + 98
11  php                           	0x0000000103424eae zend_execute + 318
12  phalcon.so                    	0x000000010690bad7 zephir_require_ret + 295

PHP7.3 Phalcon 3.4.2

@sergeyklay
Copy link
Contributor

sergeyklay commented Jan 10, 2019

@npfedwards Could you please provide a full (not modified) bt ? And secondly, is there any chance to locate test that leads to the segfault? An I'll need Zephir version

@npfedwards
Copy link
Author

Ok some more info

phalcon

Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.4.2
Build Date => Jan 10 2019 16:45:55
Powered by Zephir => Version 0.10.14-975ad02db4

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.column_renaming => On => On
phalcon.orm.disable_assign_setters => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.enable_literals => On => On
phalcon.orm.events => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.not_null_validations => On => On
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.virtual_foreign_keys => On => On

php_2019-01-10-164740_Protectorate-of-Grayson.txt

@npfedwards
Copy link
Author

Pretty sure it's the first test that loads anything Phalcon.

@sergeyklay
Copy link
Contributor

@npfedwards What Zephir version did you use? Also I'll need the code/test to reproduce

@npfedwards
Copy link
Author

@sergeyklay Zephir version is above. I'll get on reproducible test case.

@zachleigh
Copy link

Having the same problem.

PHP Version: 7.2.12
Phalcon: Version 3.4.1
Zephir Version: 0.10.10-d1b4cc68d9
PHPUnit Version: 7.5.2

Full bt:

#0  0x00007f47eda9be7a in zephir_array_update_zval () from /usr/local/lib/php/extensions/no-debug-non-zts-20170718/phalcon.so
#1  0x00007f47edb2fd40 in zim_Phalcon_Session_Adapter_set () from /usr/local/lib/php/extensions/no-debug-non-zts-20170718/phalcon.so
#2  0x00007f47eebccc15 in xdebug_execute_internal (current_execute_data=0x7f47eee22440, return_value=0x7ffc1b0b6910) at /tmp/pear/temp/xdebug/xdebug.c:2021
#3  0x000000000093cbaf in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:909
#4  execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#5  0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee22390) at /tmp/pear/temp/xdebug/xdebug.c:1912
#6  0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#7  execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#8  0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee21f70) at /tmp/pear/temp/xdebug/xdebug.c:1912
#9  0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#10 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#11 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee21e30) at /tmp/pear/temp/xdebug/xdebug.c:1912
#12 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#13 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#14 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee21990) at /tmp/pear/temp/xdebug/xdebug.c:1912
#15 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#16 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#17 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee21220) at /tmp/pear/temp/xdebug/xdebug.c:1912
#18 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#19 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#20 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee201d0) at /tmp/pear/temp/xdebug/xdebug.c:1912
#21 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#22 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#23 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1f6b0) at /tmp/pear/temp/xdebug/xdebug.c:1912
#24 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#25 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#26 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1f150) at /tmp/pear/temp/xdebug/xdebug.c:1912
#27 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#28 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#29 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1eeb0) at /tmp/pear/temp/xdebug/xdebug.c:1912
#30 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#31 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#32 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1ed20) at /tmp/pear/temp/xdebug/xdebug.c:1912
#33 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#34 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#35 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1eba0) at /tmp/pear/temp/xdebug/xdebug.c:1912
#36 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#37 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#38 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1e790) at /tmp/pear/temp/xdebug/xdebug.c:1912
#39 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#40 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#41 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1d820) at /tmp/pear/temp/xdebug/xdebug.c:1912
#42 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#43 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#44 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1d4b0) at /tmp/pear/temp/xdebug/xdebug.c:1912
#45 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#46 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#47 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1d150) at /tmp/pear/temp/xdebug/xdebug.c:1912
#48 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#49 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#50 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1cb50) at /tmp/pear/temp/xdebug/xdebug.c:1912
#51 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#52 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#53 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1c6a0) at /tmp/pear/temp/xdebug/xdebug.c:1912
#54 0x000000000093d8ec in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:1013
#55 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59768
#56 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1c590) at /tmp/pear/temp/xdebug/xdebug.c:1912
#57 0x000000000093cdcc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:888
#58 execute_ex (ex=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:59765
#59 0x00007f47eebcbf21 in xdebug_execute_ex (execute_data=0x7f47eee1c030) at /tmp/pear/temp/xdebug/xdebug.c:1912
#60 0x000000000093f1ce in zend_execute (op_array=op_array@entry=0x7f47eee7d2a0, return_value=return_value@entry=0x0) at /usr/src/php-7.2.12/Zend/zend_vm_execute.h:63776
#61 0x000000000088d813 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/php-7.2.12/Zend/zend.c:1502
#62 0x0000000000828cd0 in php_execute_script (primary_file=primary_file@entry=0x7ffc1b0ba3d0) at /usr/src/php-7.2.12/main/main.c:2590
#63 0x00000000009415a9 in do_cli (argc=5, argv=0x2018060) at /usr/src/php-7.2.12/sapi/cli/php_cli.c:1011
#64 0x000000000044863c in main (argc=5, argv=0x2018060) at /usr/src/php-7.2.12/sapi/cli/php_cli.c:1404

@sergeyklay
Copy link
Contributor

sergeyklay commented Jan 17, 2019

@zachleigh Could you please disable Xdebug and try to get backtrace again? And yes, I'll need code to reproduce. As I know Phalcon has thousands of tests

@npfedwards
Copy link
Author

@sergeyklay First instantiation of an incubator MongoCollection. Phalcon\Mvc\Model does not cause the segfault. https://gist.github.com/npfedwards/df01da6507e127304a41d93ec253af6b

@dreamsxin
Copy link
Contributor

Mybe same

#1775
phalcon/cphalcon#13703

@sergeyklay
Copy link
Contributor

Closing, this is fixed. But if I have made an oversight or there are bugs, we can follow up in separate issues. Thank you for the bug report

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

No branches or pull requests

4 participants