-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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 on accessing enum cases with OPCache enabled #11807
Comments
@adlenton Hi! It indeed looks like this might have the same root cause as #10914 (fixed by #11675). You might be able to enable |
Thank you for providing such quick feedback! Unfortunately I'm unable to reach the segfault when enabling
Do you think it's benefitial to report this on the igbinary project? This is not happening without the protect_memory option. |
@adlenton That looks similar to the bug in #11675, so it's possible that this is your root cause. |
Yes: https://github.com/igbinary/igbinary/blob/102ad68159791e76667f8455cbc171e6ec78253c/src/php7/igbinary.c#L3034 uses |
Yes, that appears to be confirmed by the debug backtrace:
Thank you for your support, I will then check the open issues there and raise one if it's not reported yet. 🙏 |
Great, it looks like the issue in igbinary was resolved. I'll close this issue. If you're still experiencing anything unexpected, let us know. |
Description
In our project we've started adapting PHP enums and on our first "bigger scale" use case we're running into a segfault - seemingly on accessing an enum case.
gdb stacktrace:
Unfortunately I was not able to construct a minimal reproducable setup, therefore I will add some context on the project and the enums classes involved.
Our php modulues:
The enum we've added:
The trait we're including:
The BoostHintVO class mentioned in the stacktrace:
line 16 from the stacktrace is the line of the constructor with the reference to the
::All
case.The segfault only occurs with opcache enabled. The first request on a freshly restarted php-fpm process will succeed, the second request fails with the segfault.
The enum case
All
is being referenced from 30 places in our codebase, a lot of times as a default argument on an optional method parameter.The segfault also occurred when modifying the
BoostHintVO::create
to accept a nullable string when we called theBoostTargetedFeatureEnum::getFrom
inside the class - in case it's relevant, this static create fuction (as well as other places in the code that will reference that new enum) will get called a lot from different factories in our code that produce these VOs that are sent to clients. If there is any more context I can or should provide please do let me know!When searching for other segfaults related to php enums I found #10914 where the faulty/changed code looks fairly similar to where it's failing according the stacktrace:
php-src/Zend/zend_API.c
Line 1324 in badfe4f
vs
nielsdos@e6abc93#diff-a9c2ca78a68a3ad33d5b00dd7f1d37aa2ac438dbff79d56d06918aefaf6fe4af
This might be absolutely unrelated as I have no prior experience in php core development, however I wanted to mention it in case the causes are indeed related.
PHP Version
PHP 8.1.21
Operating System
Debian 11.7
The text was updated successfully, but these errors were encountered: