Magento – Magento 2: RuntimeException it is being used by another process

cachecustomexceptionmagento2module

When I do clear cache using command line & refresh page on Frontend 1st time it gives below exception.

1 exception(s): Exception #0 (RuntimeException): The path
"D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php.6260"
cannot be renamed into
"D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php"
Warning!rename(D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php.6260,D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php):
The process cannot access the file because it is being used by another
process. (code: 32)

When i refresh same page again/2nd time it loads page proper. What will be cause for above exception?

Best Answer

My best guess is that while the setup:di:compile compilation process is running and Magento is processing requests (e.g. tries to bootstrap), this exception might appear.

Suggestion:

  • enable maintenance mode
  • stop cron processing
  • deploy your changes (run compilation, static content deploy, etc)

From my perspective this is not a bug, but imperfect deploy process.

I will try to update the answer if I found out any more details.

Related Topic