error=[37]ITEM TOO BIG, script tried to access a property on an incomplete object, and Call to a member function set() on null after 8.x-2.6 upgrade

Created on 18 July 2024, 4 months ago
Updated 28 August 2024, 3 months ago

Problem/Motivation

I have a couple of sites with extreme issues after the 8.x-2.6 upgrade. In both cases after initially deploying and testing we did not experience any problems but over time we observed extremely high levels of new PHP errors.

I've had to downgrade to 8.x-2.5 for now and I'm still a little unclear on exact reproduction steps but I'm starting this issue for visibility.

Steps to reproduce

I'm not sure if this is 100% reproducible but the pattern for our sites seem to be:

  1. Attempt to load a page that tries to cache something too large for an memcache object.
  2. An error will be logged, but the page will load.
  3. Attempt to load the page again.
  4. Page load fails with dynamic page cache issues due to an incomplete cache object.

Example series of logs from one our sites:

Initial load:

MemcachedDriver::set() error key=41406a1b2cf2436dba1d3d1a845ea7da_%3Adynamic_page_cache%3A-response%3A%5Brequest_format%5D%3Dhtml%3A%5Broute%5D%3Dkcts9_content_services.roku.search_feed35786c7117b4e38d0f169239752ce71158266ae2f6e4aa230fbbb87bd699c0e3 error=[37]ITEM TOO BIG

Subsequent loads:

Warning: Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::onRequest(): The script tried to access a property on an incomplete object. Please ensure that the class definition "Drupal\Core\Cache\CacheableResponse" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest() (line 145 of /var/www/html/docroot/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php)

#0 /var/www/html/docroot/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 /var/www/html/docroot/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php(145): _drupal_error_handler()
#2 [internal function]: Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest()
#3 /var/www/html/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#4 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(157): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#5 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#6 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#7 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#8 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#9 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle()
#10 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#11 /var/www/html/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle()
#12 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle()
#13 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#14 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#15 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#16 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#17 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle()
#18 {main}

---

Error: Call to a member function set() on null in Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest() (line 145 of /var/www/html/docroot/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php).

#0 [internal function]: Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest()
#1 /var/www/html/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#2 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(157): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#3 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#4 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#5 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#6 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#7 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle()
#8 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#9 /var/www/html/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle()
#10 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle()
#11 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#12 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#13 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#14 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#15 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle()
#16 {main}

Rebuilding the cache resolves the issue, but only until the too large cache is attempted again.

The issue goes away entirely when downgrading to 8.x-2.5.

Proposed resolution

None yet.

Remaining tasks

Determine what is causing the issue.

πŸ› Bug report
Status

Fixed

Version

2.6

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States wells Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @wells
  • πŸ‡¬πŸ‡§United Kingdom ippy

    Reporting similar issue, with certain blocks generating MemcachedDriver::set() error ... ITEM TOO BIG.
    No other obvious related errors.
    The content loads initially but a page refresh returns empty block.
    Downgrade to 8.x-2.5 and the issue goes away.

  • πŸ‡΅πŸ‡ΉPortugal jrochate

    Same here, for example when listing users.

  • πŸ‡©πŸ‡ͺGermany FeyP

    Had a similar issue with a cacheable response from a rest resource. I didn't try downgrading, but instead moved the dynamic page cache into redis for now.

    Speculating that πŸ“Œ Memcache performance issue from big (i.e. chunked) cache items Fixed might have introduced a regression?

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    I looked at the commits and found this:
    https://git.drupalcode.org/project/memcache/-/commit/cb11e23520860ee6a46...

      private function combineItems(array $items) {
    -    return unserialize(implode(array_column($items, 'data')));
    +    return unserialize(implode(array_column($items, 'data')), ['allowed_classes' => FALSE]);
      }
    

    Maybe this may cause missing or incomplete classes?

  • πŸ‡΅πŸ‡ΉPortugal jrochate

    Thanks @jan! For me it doesn't break now, when listing users and in other places where I was having memcache's WSOD.

    I'm sending a simple patch just to keep speed up people who would like to test it also.

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    jan kellermann β†’ changed the visibility of the branch 8.x-2.x to hidden.

  • Status changed to Needs review 4 months ago
  • πŸ‡©πŸ‡ͺGermany jan kellermann

    Created fork and MR.

  • Pipeline finished with Success
    4 months ago
    Total: 188s
    #239246
  • πŸ‡ΊπŸ‡¦Ukraine vselivanov Kyiv, Ukraine

    Thanks @jan! Patch #7 with this fix works for me.
    I also had related 500 PHP errors when visiting views page:

    TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, __PHP_Incomplete_Class given in htmlspecialchars() (line 437 of /var/www/cmds/docroot/core/lib/Drupal/Component/Utility/Html.php).
    #0 /var/www/cmds/docroot/core/lib/Drupal/Component/Utility/Html.php(437): htmlspecialchars()
    #1 /var/www/cmds/docroot/core/lib/Drupal/Component/Render/FormattableMarkup.php(268): Drupal\Component\Utility\Html::escape()
    #2 /var/www/cmds/docroot/core/lib/Drupal/Component/Render/FormattableMarkup.php(217): Drupal\Component\Render\FormattableMarkup::placeholderEscape()
    #3 /var/www/cmds/docroot/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(195): Drupal\Component\Render\FormattableMarkup::placeholderFormat()
    #4 /var/www/cmds/docroot/core/lib/Drupal/Component/Utility/ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
    #5 /var/www/cmds/docroot/core/modules/views_ui/src/ViewEditForm.php(1148): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
    #6 /var/www/cmds/docroot/core/modules/views_ui/src/ViewEditForm.php(622): Drupal\views_ui\ViewEditForm->getFormBucket()
    

    And this one:

    Error: Object of class __PHP_Incomplete_Class could not be converted to string in Drupal\views\Plugin\views\relationship\RelationshipPluginBase->defineOptions() (line 97 of /var/www/cmds/docroot/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php)
    #0 /var/www/cmds/docroot/core/modules/views/src/Plugin/views/PluginBase.php(143): Drupal\views\Plugin\views\relationship\RelationshipPluginBase->defineOptions()
    #1 /var/www/cmds/docroot/core/modules/views/src/Plugin/views/HandlerBase.php(109): Drupal\views\Plugin\views\PluginBase->init()
    #2 /var/www/cmds/docroot/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php(67): Drupal\views\Plugin\views\HandlerBase->init()
    
  • πŸ‡¨πŸ‡±Chile lathan Chile

    This killed a few of our sites, patch in #7 works

  • Status changed to RTBC 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Shawn DeArmond

    This affected our sites as well. Patch #7 fixes it.

  • First commit to issue fork.
  • Pipeline finished with Skipped
    3 months ago
    #254104
  • Status changed to Fixed 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    Bah. linting is the bane of things. I've reverted it and committed. Will get a release out shortly.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024