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

[2.0.0] segfault in ZTS #35

Open
remicollet opened this issue Feb 4, 2020 · 6 comments
Open

[2.0.0] segfault in ZTS #35

remicollet opened this issue Feb 4, 2020 · 6 comments

Comments

@remicollet
Copy link
Contributor

Various segfault running test suite on thread safe build

Ex:

(gdb) bt
#0  zval_internal_ptr_dtor (zval_ptr=0x555555b5fbf0) at /usr/src/debug/php-7.3.14-1.fc31.remi.x86_64/Zend/zend_variables.c:120
#1  0x0000555555807e2d in destroy_zend_class (zv=<optimized out>) at /usr/src/debug/php-7.3.14-1.fc31.remi.x86_64/Zend/zend_opcode.c:311
#2  0x000055555582467d in zend_hash_destroy (ht=0x555555b21600) at /usr/src/debug/php-7.3.14-1.fc31.remi.x86_64/Zend/zend_hash.c:1418
#3  0x0000555555811a45 in compiler_globals_dtor (compiler_globals=0x555555a26d00) at /usr/src/debug/php-7.3.14-1.fc31.remi.x86_64/Zend/zend.c:650
#4  0x00005555557a3c82 in tsrm_shutdown () at /usr/src/debug/php-7.3.14-1.fc31.remi.x86_64/TSRM/TSRM.c:192
#5  0x0000555555666516 in main (argc=62, argv=0x555555a221f0) at /usr/src/debug/php-7.3.14-1.fc31.remi.x86_64/sapi/cli/php_cli.c:1410

@remicollet
Copy link
Contributor Author

Seems you need a GINIT / GSHUTDOWN function... but IIRC create zval there is not possible

@rtheunissen
Copy link
Contributor

php_decimal_dtor_decimal_constants is called in RSHUTDOWN.

@remicollet
Copy link
Contributor Author

Yes, but in ZTS module, globals must be managed per thread, so allocated in GINIT and freed in GSHUTDOWN...

@rtheunissen
Copy link
Contributor

I'll do some reading tomorrow to become familiar. Thank you for the direction. 🙇

@remicollet
Copy link
Contributor Author

I think that what is wrong is trying to create class constant (module level) using some zval define are another level (request for now)

@remicollet
Copy link
Contributor Author

remicollet commented Feb 5, 2020

Digging a bit more, I think class constants being of the same class is not possible (in PHP code or in C extension).

Dropping the 2 constants solves the issue.

Also it doesn"t work in web env, only on first request for a process, second request raise error and segfault.

==> www-error.log <==
[05-Feb-2020 09:47:11 UTC] PHP Fatal error:  Cannot redefine class constant Decimal\Decimal::PI in Unknown on line 0
[05-Feb-2020 09:47:11 UTC] PHP Fatal error:  Internal zval's can't be arrays, objects, resources or reference in Unknown on line 0

==> error.log <==
[05-Feb-2020 10:47:11] WARNING: [pool www] child 637713 exited on signal 11 (SIGSEGV) after 198.805216 seconds from start
[05-Feb-2020 10:47:11] NOTICE: [pool www] child 638264 started

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

2 participants