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
"Cannot instantiate" from|trait|abstract class from #9675
Im sorry but I cannot replicate this on demand. I cannot give you a test case and the details I have are very vague.
Basically, when trying to instantiate a concrete class (in production, which might mean this is when opcache is ramped up, or other caching in place), PHP will randomly throw an exception with the message in the format of the following - note this is the FULL message, the actual class is not mentioned and the message appears to be truncated.
This issue still seems to be present in RC7. We just got hit by it in production.
The errors only happen the first time as opcache is being built, so in our case we were able to reproduce it by reloading FPM while the application was still serving requests.
Correct it is still present in RC7 - I have experienced it on every deployment but I did not want to reopen this until someone else had experienced it in case it was specific to my set up.
BTW, produced errors are not always related to instantiation. We also got stuff such as:
Symfony\Component\ExpressionLanguage\Parser::parse(): Argument #1 ($stream) must be of type Symfony\Component\ExpressionLanguage\TokenStream, Symfony\Component\ExpressionLanguage\TokenStream given
Compile Error: Class Doctrine\ORM\Query cannot extend interface from
I'm also having a weird error (in production) which I cannot reproduce as it's not happening every time (opcache is enabled)
Compile Error: Class Doctrine\\ORM\\Query\\Expr\\Select cannot extend final class from "file":"/var/www/app/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Select.php","line":12
But as you can see, Select extends Base which is not final
@akalineskou It you're interested, please help us verify the fix I submitted. These kinds of errors are practically impossible to catch with automated tests.
We get same issue from PHP 8.2.1, Ubuntu 22.04, AWS/Ec2/Graviton2/ARMs.
It is affecting only some requests. Most are fine (fortunately) because we are all in on production :)
All apps are Symfony 6.2.x and php config is failry simple:
Instead of telling that you are affected by this, too, it would be better to check whether #10143 solves the problem. :)
I would absolutely love to compile with the patch and test but I can never seem to replicate the issue. I had a go last night on a testbed.
If someone can pinpoint how it occurs then I would be happy to test with/without the patch :)
@josefbenjac The fix was just merged yesterday and will be bundled with PHP 8.2.2.
Reacted by Scott, Christoph M. Becker, Milan Miščević, Luka Skupnjak, Tony Vermeiren, Maxim Tugaev, Ahmet Hatipoğlu, Michael Käfer, Michel Bardelmeijer, Josef Benjač and 2 more
Activity
cmb69 commentedon Oct 5, 2022
It rather looks that
ZSTR_VAL(class_type->name)is "from". There might be a memory corruption.PhilETaylor commentedon Oct 5, 2022
Just in case - this is the opcache config from production (which itself is a docker container)
PhilETaylor commentedon Nov 13, 2022
This seems resolved in PHP 8.2 RC 6 released this week so "maybe" connected to something contained in https://news-web.php.net/php.internals/118991
cmb69 commentedon Nov 14, 2022
Possibly. Most important is that it is fixed. :)
spideyfusion commentedon Dec 6, 2022
This issue still seems to be present in RC7. We just got hit by it in production.
The errors only happen the first time as opcache is being built, so in our case we were able to reproduce it by reloading FPM while the application was still serving requests.
opcache related configuration
Error examples
Uncaught Error: Cannot instantiate interface fromCompile Error: Class AppBundle\ApiDoc\OpenApiResponseOK cannot extend interface tryFromOther notes
Our application is based on Symfony 5.4.16
PhilETaylor commentedon Dec 6, 2022
Correct it is still present in RC7 - I have experienced it on every deployment but I did not want to reopen this until someone else had experienced it in case it was specific to my set up.
I'll reopen it now.
PhilETaylor commentedon Dec 6, 2022
@cmb69 please re-add label for "Needs Triage"
spideyfusion commentedon Dec 8, 2022
BTW, produced errors are not always related to instantiation. We also got stuff such as:
Symfony\Component\ExpressionLanguage\Parser::parse(): Argument #1 ($stream) must be of type Symfony\Component\ExpressionLanguage\TokenStream, Symfony\Component\ExpressionLanguage\TokenStream givenCompile Error: Class Doctrine\ORM\Query cannot extend interface from12 remaining items
akalineskou commentedon Jan 3, 2023
I'm also having a weird error (in production) which I cannot reproduce as it's not happening every time (opcache is enabled)
Compile Error: Class Doctrine\\ORM\\Query\\Expr\\Select cannot extend final class from"file":"/var/www/app/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Select.php","line":12But as you can see,
SelectextendsBasewhich is not finalhttps://github.com/doctrine/orm/blob/2.14.0/lib/Doctrine/ORM/Query/Expr/Select.php
https://github.com/doctrine/orm/blob/2.14.0/lib/Doctrine/ORM/Query/Expr/Base.php
Edit: I also noticed the
Cannot instantiate interface from"file":"/var/www/app/vendor/doctrine/orm/lib/Doctrine/ORM/QueryBuilder.php","line":793https://github.com/doctrine/orm/blob/2.14.0/lib/Doctrine/ORM/QueryBuilder.php#L793
spideyfusion commentedon Jan 4, 2023
@akalineskou It you're interested, please help us verify the fix I submitted. These kinds of errors are practically impossible to catch with automated tests.
scottasmith commentedon Jan 10, 2023
I'm also seeing this issue in the below PHP version in Docker based on the
php:8.2-fpmimage on an AWS/ARM64 container.drekinov commentedon Jan 11, 2023
We get same issue from PHP 8.2.1, Ubuntu 22.04, AWS/Ec2/Graviton2/ARMs.
It is affecting only some requests. Most are fine (fortunately) because we are all in on production :)
All apps are Symfony 6.2.x and php config is failry simple:
cmb69 commentedon Jan 11, 2023
Instead of telling that you are affected by this, too, it would be better to check whether #10143 solves the problem. :)
scottasmith commentedon Jan 11, 2023
I would absolutely love to compile with the patch and test but I can never seem to replicate the issue. I had a go last night on a testbed.
If someone can pinpoint how it occurs then I would be happy to test with/without the patch :)
tomocrafter commentedon Jan 14, 2023
I'm in the same boat with laravel
This bug is difficult to reproduce, but certainly occurs unpredictable and rare in real-world applications.
ziming commentedon Jan 14, 2023
it happen for me quite often in laravel nova on php 8.2 with op cache on
Fix phpGH-9675: Re-adjust run_time_cache init for internal enum methods
Fix GH-9675: Re-adjust run_time_cache init for internal enum methods
ssx commentedon Jan 17, 2023
@spideyfusion @bwoebi 👍🏼
josefbenjac commentedon Jan 17, 2023
Error is still happening, update to 8.2.1 did not help. It happens quite often but randomly it even passes.
spideyfusion commentedon Jan 17, 2023
@josefbenjac The fix was just merged yesterday and will be bundled with PHP 8.2.2.