I am not entirely sure if the issue is related to supercache or wincache. can't disable supercache since wincache needs it.
So the problem is with incorrect/missing cache. When content is being constantly edited, somehow cache gets corrupted, resulting in Drupal showing 500 error. Biggest headache is to debug it because everytime it fails retrieving different things from cache.
For example:
This following error is because cache entry in database has empty data attribute.
Error: Call to a member function id() on boolean in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 266 of core\lib\Drupal\Core\Entity\EntityStorageBase.php).
TypeError: Argument 1 passed to Drupal\Core\Plugin\DefaultPluginManager::doGetDefinition() must be of the type array, boolean given, called in core\lib\Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait.php on line 25 in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 43 of core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php).
TypeError: Argument 1 passed to Symfony\Component\HttpFoundation\ParameterBag::replace() must be of the type array, null given, called in core\lib\Drupal\Core\Routing\RouteProvider.php on line 150 in Symfony\Component\HttpFoundation\ParameterBag->replace() (line 63 of vendor\symfony\http-foundation\ParameterBag.php).
Error: Unsupported operand types in Drupal\Core\Menu\MenuTreeStorage->loadTreeData() (line 840 of core\lib\Drupal\Core\Menu\MenuTreeStorage.php).
Missing fields, blocks, taxonomies from drop down select, etc.
All these errors have 1 thing in common: they appear only when the site is being edited more frequently and errors vanish after cache clear.
As I mentioned, Call to a member function id() on boolean was cause by empty cache data attribute, which is pulled in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php getFromPersistentCache() function. $cache[$cid]->data was empty but the cache metadata actualyl existed therefore Drupal choked on it.
I checked wincache dashboard, it had plenty of free space left...
I'll try to make a reproducable error. p.s. we dont use couchbase, just wincache, supercache and php7
Comments
Comment #2
david_garcia commentedThat would be helpful.
If you are not using couchbase, I imagine that the underlying persistent storage is the database. What database driver/engine are you using? (versions, etc..)
Comment #3
audriusb commentedMS SQL 2012 R2, sqlsrv (not latest, gonna update asap), pdo_sqlsrv 4.1.8930.1
would you recommend using couchbase? do you know if 2.2.x php7 driver work with community edition of couchbase?
Comment #4
david_garcia commentedYes. The PHP extension works with both enterprise and community edition. The "problem" is that community is a few versions behind the enterprise version, and thus full of unfixed bugs.
Are you using 8.x-1.x or 8.x-2.x?
Comment #5
audriusb commented8.x-2.x
Comment #6
david_garcia commented@audriusb Can you please try to "disable" service overriding done by the supercache module?
In SupercacheServiceProvider.php add a "return;" at the begginig of register():
After doing so, do a rebuild and clear al caches.
Comment #7
audriusb commentedsorry, what do you mean by rebuild?
Comment #8
david_garcia commentedRebuild the service container. There are a couple of ways of achiving that. Such as going through an update process, or calling /core/rebuild.php manually.
Comment #9
Martin Borugadda commented@audriusb I have the same issue in one of my Drupal sites. Did you manage to fix it? If yes, what did you do?
Comment #10
audriusb commentedI think it is mandatory to use couchbase. Community edition works well enough.
Comment #11
Martin Borugadda commented@audriusb, so you stopped seeing this error after you started using couchbase as the database?
Comment #12
audriusb commentedcorrect but not as database. couchbase is replacement for Redis or memcache.
Comment #13
Martin Borugadda commentedThat's nice that you stopped seeing this error. In my case, I am still getting the error after disabling both WinCache and SuperCache Drupal modules.
In particular the error I'm getting is
TypeError: Argument 1 passed to Drupal\Core\Plugin\DefaultPluginManager::doGetDefinition() must be of the type array, boolean given, called in core\lib\Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait.php on line 25 in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 43 of core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php).My setup is Drupal 8.6.3 running on IIS with MSSQL Server as the database. Surprisingly we have another Drupal site running on the same Server and using the same Database but the issue doesn't occur with that site.
Any idea why this might be happening? I can share more details if needed.
(P.S: I still have opcache and wincache enabled in php.ini. I'm going to disable them and test the site)
Edit: Disabled opcache and wincache in php.ini but still see the error.
Comment #14
audriusb commentedHave you tried with wincache, supercache and couchbase enabled? without first two Drupal is not really usable on windows setup, unless 2s+ load times are acceptable. If it doesn't help, contact @david_garcia. He is maintainer of all windows based modules for Drupal.
Also do you have sqlsrv 2.x *PAID* version of sql driver?
Comment #15
Martin Borugadda commentedYes, I have the 2.* PAID version of SQLSRV. I've tried with wincache and supercache enabled, but never tried couchbase.
The following settings are used for wincache.
wincache.ucachesize = 30And the following settings for opcache.
opcache.mmap_base = 0*20000000Do you have any recommendations for wincache and opcache settings on a Windows Server, running with 16 - 32 GB RAM and 4 core Xeon CPU?
I am assuming you are suggesting using Couchbase as a cache backend and not as the real database for Drupal. Can you please share any links that have instructions on installing and using Couchbase in Drupal 8?
Thanks
Comment #16
audriusb commentedhttp://www.drupalonwindows.com/en/blog/drupal-8-couchbase-integration
Screenshots are outdated but you can get the gist.
Comment #17
Martin Borugadda commented@audriusb, I'm using the following in my settings.php, but getting an error.
The error reads
Unable to connect to couchbase bucket. Fix any issues and rebuild the service container. Invalid arguments.In addition when I ran update.php, I'm getting the following warning.
Warning: Couchbase\Cluster::__construct() expects exactly 1 parameter, 3 given in Drupal\couchbasedrupal\CouchbaseManager->getCluster() (line 157 of C:\drupal\modules\contrib\couchbasedrupal\src\CouchbaseManager.php)Can you please check if the format in the settings.php is right?