You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Constants in Enum classes causes php-fpm worker to segfault #8133
When I use this constant in a loop in another class, the php-worker crashes
foreach (ResultsModifier::SPECIAL_MODIFIERS as $modifier) {
// segfault
Output:
[21-Feb-2022 23:28:26] WARNING: [pool www] child 46 exited on signal 11 (SIGSEGV) after 3.227291 seconds from start
The same code works if I:
either turn off opcache (opcache.enable = 0)
either remove reference to the constant:
foreach ([ResultsModifier::AWAY, ResultsModifier::HOME, ResultsModifier::OVERTIME, ResultsModifier::REGULATION_TIME] as $modifier) {
// works as expected
I cannot reproduce the segfault (PHP-8.1 on Windows CLI; tried with JIT and without). If I put var_dump($modifiers); in the loop body, I get the expected:
changed the title [-]Contants in Enum classes causes php-fpm worker to segfault[/-][+]Constants in Enum classes causes php-fpm worker to segfault[/+]on Feb 22, 2022
I think you still could get a backtrace if you're running under gdb; after the assertion has been triggered, typing bt should provide it. However, I guess the assertion failed due to a prior memory corruption. Are you running with JIT enabled (if in doubt, check PHP info)? If so, what's the value of opcache.jit?
I failed at it. As far as I understand, gdb attaches to one of the fpm processes. But my php-fpm (when compiled with --enable-debug) doesn't start at all. I should also clarify that I observe this in a docker container inside a kubernetes pod.
Also, I cannot reproduce it running same script in CLI (even with opcache.enable_cli => On).
Just for the record, we're experiencing really strange errors after re-enabling preloading on PHP 8.1.6, as if the memory was somehow messed up:
return BillingType::tryFrom($value);
where BillingType is regular backed enum:
enum BillingType: string
{
case Terms = 'terms';
case Prepaid = 'prepaid';
}
fails on following error: Fulfillment\CommonBundle\Utils\EnumHelper::create(): Return value must be of type BackedEnum, Doctrine\ORM\Id\IdentityGenerator returned, which does not make any sense.
We're still using the same preloading configuration which worked before transitioning from constants to enums and the code works just fine with preloading disabled.
I'll try to create a reproducible case and submit a new issue, I just wanted to warn others about possible problems for now.
@iluuu1994 Yes, the issue still occurs, we're running with preloading disabled. I was just not able to create a reproducible test case nor extract some insightful logs as I was quite busy for the past week (and will be for the week to come).
If you're fine with creating an open issue with no more details than those I posted to this channel, I'll create the issue offhand :)
Activity
cmb69 commentedon Feb 22, 2022
I cannot reproduce the segfault (PHP-8.1 on Windows CLI; tried with JIT and without). If I put
var_dump($modifiers);in the loop body, I get the expected:Can you please provide a stack backtrace?
alshenetsky commentedon Feb 22, 2022
I would be happy to, and I have the coredump file, but when I compiled php with the --enable-debug flag, my application no longer runs:
Assertion failed: zval_get_type(&(*(z))) < 6 (/usr/src/php/ext/opcache/zend_persist_calc.c: zend_persist_zval_calc: 138)So I can't, sorry.
[-]Contants in Enum classes causes php-fpm worker to segfault[/-][+]Constants in Enum classes causes php-fpm worker to segfault[/+]cmb69 commentedon Feb 23, 2022
I think you still could get a backtrace if you're running under gdb; after the assertion has been triggered, typing
btshould provide it. However, I guess the assertion failed due to a prior memory corruption. Are you running with JIT enabled (if in doubt, check PHP info)? If so, what's the value ofopcache.jit?alshenetsky commentedon Feb 24, 2022
I failed at it. As far as I understand, gdb attaches to one of the fpm processes. But my php-fpm (when compiled with --enable-debug) doesn't start at all. I should also clarify that I observe this in a docker container inside a kubernetes pod.
Also, I cannot reproduce it running same script in CLI (even with opcache.enable_cli => On).
In answer to the second question:
11 remaining items
iluuu1994 commentedon Apr 14, 2022
Thanks for the hint, I can reproduce it with preloading.
janedbal commentedon Apr 21, 2022
Thanks!
olsavmic commentedon May 20, 2022
Just for the record, we're experiencing really strange errors after re-enabling preloading on PHP 8.1.6, as if the memory was somehow messed up:
where BillingType is regular backed enum:
fails on following error:
Fulfillment\CommonBundle\Utils\EnumHelper::create(): Return value must be of type BackedEnum, Doctrine\ORM\Id\IdentityGenerator returned, which does not make any sense.We're still using the same preloading configuration which worked before transitioning from constants to enums and the code works just fine with preloading disabled.
I'll try to create a reproducible case and submit a new issue, I just wanted to warn others about possible problems for now.
cmb69 commentedon May 20, 2022
@olsavmic, yes, please file a new ticket. :)
iluuu1994 commentedon May 27, 2022
@olsavmic You never created an issue for this, are you still experiencing this problem?
olsavmic commentedon May 27, 2022
@iluuu1994 Yes, the issue still occurs, we're running with preloading disabled. I was just not able to create a reproducible test case nor extract some insightful logs as I was quite busy for the past week (and will be for the week to come).
If you're fine with creating an open issue with no more details than those I posted to this channel, I'll create the issue offhand :)
iluuu1994 commentedon May 27, 2022
@olsavmic It can also wait until you have more information, I just wanted to confirm this is still an issue. 🙂 Thanks for your response.