The opcache file check is on by default to support applications that generate code at runtime. You can turn it off yourself via .platform.app.yaml like so:
variables:
php:
'opcache.validate_timestamps': 0
The PHP-FPM server is restarted when you update code anyway. The default composer command we use already optimizes the autoloader.
After investigating a bit, I found that sometimes Symfony templates are not updated correctly and still using their previous (probably cached) version.
Could it be a case of not triggering a new build, just a deploy, and so you don’t get updated code? I assume by Symfony templates you mean compiled Twig templates.
(Sorry for the delay; Discourse’s notifications are not great.)
Yes, a code push that changes files in that application will trigger a new build; you can see in the console output if it’s building, and if there are any error messages along the way.
I’m 98.3% certain that a deploy after a build will always cause FPM to restart, which should clear the opcache. Without looking at your project specifically I’m not sure what the issue could be. All of your templates are being compiled at build time, not deploy time, yes?
I think I’m having the same issue. The twig files files are being regenerated by cache:clear in my deploy hook. I can see that in var/cache/prod I have the correct version. But the files being served are still the old ones.
Same as @quentin-thiaucourt I use cache:clear in both my hooks as per template.
After troubleshooting the issue with the support, commenting out: # opcache.preload: /app/config/preload.php
Solved the issue. I guess it was called too early and generated the opcache based on the old files?