Hi,
We faced issue with code caching on multisite. In our structure we have few sites and in each of them we have modules folder.
Case 1:
On-site A we have EventSubscriber with 2 events(E1 and E2).
On-site B we have EventSubscriber with 1 events(E1).
After a while, we get site B down because drupal trying to call callback of E1 event but this method does not exist.
Case 2:
On-site A we have SomeForm with a redirect to page P1.
On-site B we have SomeForm with a redirect to page P2.
After a while on submit form on site B we get redirected to page P1.
After some investigation, i found the approximate cause of the error. Drupal use APC for caching, but site_path variable does not uses on building of apc prefix building.
web/core/lib/Drupal/Core/DrupalKernel.php:1041
protected function initializeSettings(Request $request) {
$site_path = static::findSitePath($request);
$this->setSitePath($site_path);
$class_loader_class = get_class($this->classLoader);
Settings::initialize($this->root, $site_path, $this->classLoader);
// Initialize our list of trusted HTTP Host headers to protect against
// header attacks.
$host_patterns = Settings::get('trusted_host_patterns', []);
if (PHP_SAPI !== 'cli' && !empty($host_patterns)) {
if (static::setupTrustedHosts($request, $host_patterns) === FALSE) {
throw new BadRequestHttpException('The provided host name is not valid for this server.');
}
}
// If the class loader is still the same, possibly
// upgrade to an optimized class loader.
if ($class_loader_class == get_class($this->classLoader)
&& Settings::get('class_loader_auto_detect', TRUE)) {
$prefix = Settings::getApcuPrefix('class_loader', $this->root);
In the last line you can see that $site_path does not send to prefix builder.