πŸ‡³πŸ‡±Netherlands @nikhileshpaul

Eindhoven
Account created on 29 May 2014, over 10 years ago
#

Recent comments

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Below is the approach I followed

  • Create a controller with a static method which calls the opcache_reset() function
  • Expose this static method using a custom route
  • Create a custom drush command, something like drush opcl which calls this route

Few things I had to consider

  1. For some unknown reason, Drupal::httpClient() didn't work for me and I had to go with curl
  2. My application is behind a proxy so I had to set curl_setopt($ch, CURLOPT_PROXY, ''); for the call to local server to go through
  3. The curl call needs an absolute URL which will differ for each environment, so had to add this as a settings variable in settings.local.php
  4. For environments where the servers sit behind a load balancer, giving the load balancer/application URL didn't work. I had to manually add the web servers in the settings variable and loop through them resetting the cache. This might be an issue with cloud setups where servers are initialized on demand
πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

We faced this issue immediately after a code deployment which clears cache as a final step. Noticed high CPU usage by the PHP-FPM process in web server and fixed it by restarting the FPM process

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Tested #16 and works fine

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Issue resolved after performing a full cache clear using "drupal_flush_all_caches". "drush cr" didn't help

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

#14 indeed works for any use case (I'm on core version 9). This is an apache level fix so should be treated as the accepted answer.

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Issue exists in core version 9.5.11

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Can this be merged?

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Can this be merged?

πŸ‡³πŸ‡±Netherlands nikhileshpaul Eindhoven

Can this be merged?

Production build 0.71.5 2024