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.

CommentFileSizeAuthor
#7 3462448-7.patch527 bytesjrochate

Issue fork memcache-3462448

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wells created an issue. See original summary.

stopopol’s picture

+1

ippy’s picture

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

...

A sharper-eyed colleague spotted this "chang[ing] view block cache from Search API (tag-based) to Search API (none), the error seems to have gone. I can view pages that caused memcache error and now get no error."
Corresponding Search API error follows:

TypeError: Drupal\search_api\Utility\QueryHelper::addResults(): Argument #1 ($results) must be of type Drupal\search_api\Query\ResultSetInterface, __PHP_Incomplete_Class given, called in /var/www/********/web/modules/contrib/search_api/src/Plugin/views/cache/SearchApiCachePluginTrait.php on line 186 in Drupal\search_api\Utility\QueryHelper->addResults() (line 86 of /var/www/********/web/modules/contrib/search_api/src/Utility/QueryHelper.php)#0 /var/www/********/web/modules/contrib/search_api/src/Plugin/views/cache/SearchApiCachePluginTrait.php(186): Drupal\search_api\Utility\QueryHelper->addResults() #1 /var/www/********/web/core/modules/views/src/ViewExecutable.php(1478): Drupal\search_api\Plugin\views\cache\SearchApiTagCache->cacheGet() #2 /var/www/********/web/modules/custom/********/src/Plugin/Block/********.php(58): Drupal\views\ViewExecutable->execute()

jrochate’s picture

Same here, for example when listing users.

feyp’s picture

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 #3386779: Memcache performance issue from big (i.e. chunked) cache items might have introduced a regression?

jan kellermann’s picture

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?

jrochate’s picture

StatusFileSize
new527 bytes

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.

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

jan kellermann’s picture

Status: Active » Needs review

Created fork and MR.

vselivanov’s picture

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()
roam2345’s picture

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

shawn dearmond’s picture

Status: Needs review » Reviewed & tested by the community

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

japerry made their first commit to this issue’s fork.

japerry’s picture

Status: Reviewed & tested by the community » Fixed

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

Status: Fixed » Closed (fixed)

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