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

Api Platform v2.7 crashes when preloading is enabled #2284

Closed
Tib-z opened this issue Oct 3, 2022 · 1 comment
Closed

Api Platform v2.7 crashes when preloading is enabled #2284

Tib-z opened this issue Oct 3, 2022 · 1 comment

Comments

@Tib-z
Copy link

Tib-z commented Oct 3, 2022

API Platform version(s) affected: 2.7.0, 2.7.1
(The issue comes from the deprecation handling, did not exist in 2.6, v3 could not test yet..)

Description
After upgrading to 2.7 (v2.7.0, v2.7.1) api-platform crashes on production where opcache.prelaod is enabled. On v2.6.8 worked fine.
Warning: Cannot declare interface ApiPlatform\Core\Api\FilterInterface, because the name is already in use in /var/www/vendor/api-platform/core/src/deprecation.php on line 15
Warning: Cannot declare interface ApiPlatform\Core\Api\ResourceClassResolverInterface, because the name is already in use in /var/www/vendor/api-platform/core/src/deprecation.php on line 16

ErrorException:
Warning: Cannot declare class ApiPlatform\Core\EventListener\ExceptionListener, because the name is already in use

at /var/www/vendor/api-platform/core/src/Symfony/EventListener/ExceptionListener.php:58
at include_once('/var/www/vendor/api-platform/core/src/Symfony/EventListener/ExceptionListener.php')
(/var/www/var/cache/dev/ContainerQBmvKM9/getApiPlatform_Listener_ExceptionService.php:20)
at ContainerQBmvKM9\getApiPlatform_Listener_ExceptionService::do(object(App_KernelDevDebugContainer), true)
(/var/www/var/cache/dev/ContainerQBmvKM9/App_KernelDevDebugContainer.php:630)
at ContainerQBmvKM9\App_KernelDevDebugContainer->load('getApiPlatform_Listener_ExceptionService.php')
(/var/www/var/cache/dev/ContainerQBmvKM9/App_KernelDevDebugContainer.php:923)
at ContainerQBmvKM9\App_KernelDevDebugContainer->ContainerQBmvKM9{closure}()
(/var/www/vendor/symfony/event-dispatcher/EventDispatcher.php:164)
at Symfony\Component\EventDispatcher\EventDispatcher->removeListener('kernel.exception', object(Closure))
(/var/www/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:287)
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->preProcess('kernel.exception')
(/var/www/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:147)
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
(/var/www/vendor/symfony/http-kernel/HttpKernel.php:213)
at Symfony\Component\HttpKernel\HttpKernel->handleThrowable(object(ErrorException), object(Request), 1)
(/var/www/vendor/symfony/http-kernel/HttpKernel.php:109)
at Symfony\Component\HttpKernel\HttpKernel->terminateWithException(object(ErrorException), object(Request))
(/var/www/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:125)
at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener{closure}(object(ErrorException))
(/var/www/vendor/symfony/error-handler/ErrorHandler.php:540)
at Symfony\Component\ErrorHandler\ErrorHandler->handleException(object(ErrorException))

How to reproduce

  • Upgrade to v2.7.*
  • Make sure opcache.preload is enabled. (I use the Symfony's default preload script);
    • opcache.preload_user=www-data
    • opcache.preload=/var/www/config/preload.php
  • Open /api or any api-platform endpoint
@russelomua
Copy link

+1 have a same problem on prod also opcache is enabled, api-platform/core v2.7.2
disabling opcache removes the problem

Warning: Cannot declare interface ApiPlatform\Core\Api\FilterInterface, because the name is already in use in /var/www/api-smartmisto/vendor/api-platform/core/src/deprecation.php on line 15
Warning: Cannot declare interface ApiPlatform\Core\Api\ResourceClassResolverInterface, because the name is already in use in /var/www/api-smartmisto/vendor/api-platform/core/src/deprecation.php on line 16

liviucmg pushed a commit to WeCodePixels/api-platform-core that referenced this issue Nov 3, 2022
soyuka pushed a commit to api-platform/core that referenced this issue Nov 4, 2022
Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>
soyuka pushed a commit to soyuka/core that referenced this issue Nov 4, 2022
Fixes api-platform/api-platform#2284 (api-platform#5110)

Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>
soyuka added a commit to api-platform/symfony that referenced this issue Sep 13, 2023
* fix: update yaml extractor test file coding standard (#5068)

* fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064)

* fix(metadata): add class key in payload argument resolver (#5067)

* fix: add class key in payload argument resolver

* add null if everything else goes wrong

* fix: upgrade command remove ApiSubresource attribute  (#5049)

Fixes #5038

* fix(doctrine): use abitrary index instead of value (#5079)

* fix: uri template should respect rfc 6570 (#5080)

* fix: remove @internal annotation for Operations (#5089)

See #5084

* fix(metadata): define a name on a single operation (#5090)

fixes #5082

* fix(metadata): deprecate when user decorates in legacy mode (#5091)

fixes #5078

* fix(graphql): use right nested operation (#5102)

* Revert "fix(graphql): use right nested operation (#5102)" (#5111)

This reverts commit 44337ddb3908d7b05ed75b75325b7941581f575b.

* fix(graphql): always allow to query nested resources (#5112)

* fix(graphql): always allow to query nested resources

* review

Co-authored-by: Alan Poulain <contact@alanpoulain.eu>

* chore: php-cs-fixer update

* fix: only alias if exists for opcache preload

Fixes api-platform/api-platform#2284 (#5110)

Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>

* chore: php-cs-fixer update (#5118)

* chore: php-cs-fixer update

* chore: php-cs-fixer update

* fix(metadata): upgrade script keep operation name (#5109)

origin: api-platform/core#5105

Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>

* chore: v2.7.3 changelog

* chore: v3.0.3 changelog

Co-authored-by: helyakin <CourcierMarvin@gmail.com>
Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com>
Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com>
Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com>
Co-authored-by: Xavier Laviron <norival@users.noreply.github.com>
Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com>
Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>
Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
soyuka added a commit to api-platform/graphql that referenced this issue Sep 13, 2023
* fix: update yaml extractor test file coding standard (#5068)

* fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064)

* fix(metadata): add class key in payload argument resolver (#5067)

* fix: add class key in payload argument resolver

* add null if everything else goes wrong

* fix: upgrade command remove ApiSubresource attribute  (#5049)

Fixes #5038

* fix(doctrine): use abitrary index instead of value (#5079)

* fix: uri template should respect rfc 6570 (#5080)

* fix: remove @internal annotation for Operations (#5089)

See #5084

* fix(metadata): define a name on a single operation (#5090)

fixes #5082

* fix(metadata): deprecate when user decorates in legacy mode (#5091)

fixes #5078

* fix(graphql): use right nested operation (#5102)

* Revert "fix(graphql): use right nested operation (#5102)" (#5111)

This reverts commit 44337ddb3908d7b05ed75b75325b7941581f575b.

* fix(graphql): always allow to query nested resources (#5112)

* fix(graphql): always allow to query nested resources

* review

Co-authored-by: Alan Poulain <contact@alanpoulain.eu>

* chore: php-cs-fixer update

* fix: only alias if exists for opcache preload

Fixes api-platform/api-platform#2284 (#5110)

Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>

* chore: php-cs-fixer update (#5118)

* chore: php-cs-fixer update

* chore: php-cs-fixer update

* fix(metadata): upgrade script keep operation name (#5109)

origin: api-platform/core#5105

Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>

* chore: v2.7.3 changelog

* chore: v3.0.3 changelog

Co-authored-by: helyakin <CourcierMarvin@gmail.com>
Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com>
Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com>
Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com>
Co-authored-by: Xavier Laviron <norival@users.noreply.github.com>
Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com>
Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>
Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
soyuka added a commit to api-platform/doctrine-odm that referenced this issue Jan 25, 2024
* fix: update yaml extractor test file coding standard (#5068)

* fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064)

* fix(metadata): add class key in payload argument resolver (#5067)

* fix: add class key in payload argument resolver

* add null if everything else goes wrong

* fix: upgrade command remove ApiSubresource attribute  (#5049)

Fixes #5038

* fix(doctrine): use abitrary index instead of value (#5079)

* fix: uri template should respect rfc 6570 (#5080)

* fix: remove @internal annotation for Operations (#5089)

See #5084

* fix(metadata): define a name on a single operation (#5090)

fixes #5082

* fix(metadata): deprecate when user decorates in legacy mode (#5091)

fixes #5078

* fix(graphql): use right nested operation (#5102)

* Revert "fix(graphql): use right nested operation (#5102)" (#5111)

This reverts commit 44337ddb3908d7b05ed75b75325b7941581f575b.

* fix(graphql): always allow to query nested resources (#5112)

* fix(graphql): always allow to query nested resources

* review

Co-authored-by: Alan Poulain <contact@alanpoulain.eu>

* chore: php-cs-fixer update

* fix: only alias if exists for opcache preload

Fixes api-platform/api-platform#2284 (#5110)

Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>

* chore: php-cs-fixer update (#5118)

* chore: php-cs-fixer update

* chore: php-cs-fixer update

* fix(metadata): upgrade script keep operation name (#5109)

origin: api-platform/core#5105

Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>

* chore: v2.7.3 changelog

* chore: v3.0.3 changelog

Co-authored-by: helyakin <CourcierMarvin@gmail.com>
Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com>
Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com>
Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com>
Co-authored-by: Xavier Laviron <norival@users.noreply.github.com>
Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com>
Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com>
Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
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