Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23632

Exception when running eZ Publish behind built in reverse proxy

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2014.11, 5.4.0-beta1
    • Fix Version/s: 2014.11, 5.4.0-rc1
    • Component/s: Caching, Platform stack
    • Labels:
      None

      Description

      When running eZ Publish with USE_HTTP_CACHE environment variable set to 1 (which means the Symfony's internal reverse proxy is activated) or with USE_HTTP_CACHE set to 0, but with Varnish 4 in front (with config provided by eZ Systems) I get an InvalidArgumentException with the error message "Invalid or Empty Node passed to getItem constructor." with the following stack trace (in Varnish case, it's the guru meditation error):

      in /var/www/html/netgensite/vendor/tedivm/stash/src/Stash/Pool.php line 132
      at Pool->getItem(array('ez_spi', 'location', null)) in /var/www/html/netgensite/vendor/tedivm/stash-bundle/Service/CacheService.php line 68
      at CacheService->getItem(array('ez_spi', 'location', null)) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Cache/CacheServiceDecorator.php line 57
      at CacheServiceDecorator->getItem('location', null) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Cache/LocationHandler.php line 27
      at LocationHandler->load(null) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/LocationService.php line 211
      at LocationService->loadLocation(null) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php line 207
      at UrlAliasGenerator->eZ\Publish\Core\MVC\Symfony\Routing\Generator\{closure}(object(Repository)) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/Repository.php line 299
      at Repository->sudo(object(Closure)) in /var/www/html/netgensite/ezpublish/cache/dev/ezpublishDevDebugProjectContainer.php line 26085
      at eZPublishCoreRepositoryRepository_0000000065ca177a00007f43a7fce3ba->sudo(object(Closure)) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/Repository.php line 196
      at Repository->sudo(object(Closure)) in /var/www/html/netgensite/ezpublish/cache/dev/ezpublishDevDebugProjectContainer.php line 30809
      at eZPublishCoreSignalSlotRepository_0000000065ca16be00007f43a7fce3ba->sudo(object(Closure)) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php line 209
      at UrlAliasGenerator->loadLocation(null) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php line 168
      at UrlAliasGenerator->getPathPrefixByRootLocationId(null) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Routing/UrlAliasRouter.php line 53
      at UrlAliasRouter->getUrlAlias('/_fos_user_context_hash') in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Symfony/Routing/UrlAliasRouter.php line 120
      at UrlAliasRouter->matchRequest(object(Request)) in /var/www/html/netgensite/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Routing/UrlAliasRouter.php line 39
      at UrlAliasRouter->matchRequest(object(Request)) in /var/www/html/netgensite/vendor/symfony-cmf/routing/ChainRouter.php line 185
      at ChainRouter->doMatch('/_fos_user_context_hash', object(Request)) in /var/www/html/netgensite/vendor/symfony-cmf/routing/ChainRouter.php line 155
      at ChainRouter->matchRequest(object(Request)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 125
      at RouterListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
      at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 59
      at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
      at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
      at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
      at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
      at ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 112
      at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 126
      at HttpKernel->handleRaw(object(Request), '1') in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 66
      at HttpKernel->handle(object(Request), '1', true) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 64
      at ContainerAwareHttpKernel->handle(object(Request), '1', true) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185
      at Kernel->handle(object(Request), '1', true) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php line 471
      at HttpCache->forward(object(Request), true, null) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php line 60
      at HttpCache->forward(object(Request), true) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php line 428
      at HttpCache->fetch(object(Request), true) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php line 328
      at HttpCache->lookup(object(Request), true) in /var/www/html/netgensite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php line 192
      at HttpCache->handle(object(Request), '1', true) in /var/www/html/netgensite/vendor/friendsofsymfony/http-cache-bundle/HttpCache.php line 82
      at HttpCache->handle(object(Request)) in /var/www/html/netgensite/vendor/friendsofsymfony/http-cache-bundle/HttpCache.php line 116
      at HttpCache->getUserHash(object(Request)) in /var/www/html/netgensite/vendor/friendsofsymfony/http-cache-bundle/HttpCache.php line 78
      at HttpCache->handle(object(Request)) in /var/www/html/netgensite/web/index.php line 77
      

      It looks like that the initial request that fetches user hash for context aware HTTP cache from /_fos_user_context_hash route is the root cause.

      After pull request #1067 (https://github.com/ezsystems/ezpublish-kernel/pull/1067), site access match is not done any more on user context request (/_fos_user_context_hash), but later on when the real request is ran again.

      Due to this, PostSiteAccessMatchEvent is never triggered and doesn't set the root location ID to URL alias router. Thus, URL alias router (which is ran later on and tries to match /_fos_user_context_hash route) fails with the above exception. Exception comes from the fact that URL alias router is trying to load the location with null location ID.

      The same issue happens in prod environment.

      Moreover, when testing /_fos_user_context_hash route from CLI with curl, there's an internal server error being returned that's possibly related to this issue:

      eddie@abyss: ~ $ curl -v -X HEAD http://ezpublish.local/_fos_user_context_hash
      * Hostname was NOT found in DNS cache
      *   Trying 127.0.0.1...
      * Connected to ezpublish.local (127.0.0.1) port 80 (#0)
      > HEAD /_fos_user_context_hash HTTP/1.1
      > User-Agent: curl/7.37.1
      > Host: ezpublish.local
      > Accept: */*
      >
      < HTTP/1.1 500 Internal Server Error
      < Date: Wed, 12 Nov 2014 17:28:53 GMT
      * Server Apache/2.4.10 (Ubuntu) is not blacklisted
      < Server: Apache/2.4.10 (Ubuntu)
      < Expires: Mon, 26 Jul 1997 05:00:00 GMT
      < Last-Modified: Wed, 12 Nov 2014 17:28:54 GMT
      < Cache-Control: no-cache, must-revalidate
      < Pragma: no-cache
      < X-Powered-By: eZ Publish Community Project
      < Served-by: ezpublish.local
      < Content-language: en-GB
      < Status: 404 Not Found
      < Cache-Control: no-cache
      < X-Cache-Debug: 1
      < X-Cache-Debug: 1
      < X-Debug-Token: 8d1cd2
      < X-Debug-Token-Link: /_profiler/8d1cd2
      < Vary: X-User-Hash
      < X-Symfony-Cache: HEAD /_fos_user_context_hash: miss
      < Connection: close
      < Content-Type: text/html; charset=UTF-8
      <
      * Closing connection 0
      eddie@abyss: ~ $
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              edi.modric Edi Modrić
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: