Skip to content

[DepdencyInjection] Fix costly logic when checking errored definitions #50905

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

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jul 6, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #50763 (comment)
License MIT
Doc PR -

@NicolJamie @X-Coder264 can you please give this patch a try and report back. Does that fix the perf issue you're having?

@X-Coder264
Copy link
Contributor

X-Coder264 commented Jul 6, 2023

@nicolas-grekas It does fix it, thanks.

Without this fix:

www-data@31ed4ece830c:/srv/app$ time bin/console ca:cl

PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 163840 bytes) in /srv/app/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 69
PHP Fatal error:  Uncaught Symfony\Component\ErrorHandler\Error\OutOfMemoryError: Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 163840 bytes) in /srv/app/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:69
Stack trace:
#0 {main}
  thrown in /srv/app/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 69
www-data@31ed4ece830c:/srv/app$ time bin/console ca:cl
PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 163840 bytes) in /srv/app/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 69
PHP Fatal error:  Uncaught Symfony\Component\ErrorHandler\Error\OutOfMemoryError: Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 163840 bytes) in /srv/app/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:69
Stack trace:
#0 {main}
  thrown in /srv/app/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 69

real    1m0.200s
user    0m59.713s
sys     0m0.464s

With this fix:

www-data@31ed4ece830c:/srv/app$ time bin/console ca:cl

In DefinitionErrorExceptionPass.php line 49:
                                                                                                                                                                                                         
  Cannot autowire service "foo": argument "$bar" of method "Baz::__construct()" is type-hinted "int", you should confi  
  gure its value explicitly.                                                                                                                                                                             
                                                                                                                                                                                                        

real    0m9.052s
user    0m8.738s
sys     0m0.308s

@nicolas-grekas nicolas-grekas force-pushed the di-fix-errored-check branch from 27b648d to 81adcd6 Compare July 7, 2023 05:47
@nicolas-grekas nicolas-grekas merged commit 9cbdfc6 into symfony:5.4 Jul 7, 2023
@nicolas-grekas nicolas-grekas deleted the di-fix-errored-check branch July 25, 2023 15:45
This was referenced Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants