You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in line PHPTAL.php:828 used not atomic writes via file_put_contents if (!file_put_contents($this->getCodePath(), $result)) {
OpCache in some cases is in time to store an empty file into the cache. Potential reasons for it is high RPS, high concurency, slow disks and so on.
File exists, it's not empty, there are no errors while requiring file, but function is not defined and we have this log message: E_ERROR: Call to undefined function tpl_... in: /var/local/www/app/outsource/PHPTAL/PHPTAL.php:667
When a file is modified on a live web server it really ought to be done in an atomic manner. That is, written to a temporary file and renamed (mv) the file into its permanent position when it is ready.
apc is really really really really really really to be avoided. It is unstable, unmaintained and can lead to random segfaults due to internal memory corruption. If the file has to be written atomically, an exclusive lock may work (although it may lead to some errors while multiple client re-generate the cache: dogpiling-alike)
I think it will improve even with LOCK_EX, Probably not enough for LOCK_EX.
The code generating process needs to create a temporary file and mv it.
Because there is a very very short time from file open to lock. If other process read the file at that time, it will appear as an empty.
Activity
Ocramius commentedon Jul 4, 2018
Would adding a
LOCK_EXsolve this?alantum commentedon Jul 4, 2018
http://php.net/manual/en/apc.configuration.php#ini.apc.file-update-protection
Ocramius commentedon Jul 4, 2018
apcis really really really really really really to be avoided. It is unstable, unmaintained and can lead to random segfaults due to internal memory corruption. If the file has to be written atomically, an exclusive lock may work (although it may lead to some errors while multiple client re-generate the cache: dogpiling-alike)alantum commentedon Jul 4, 2018
I took APC as good documented example. In real project we use OpCache https://secure.php.net/manual/en/opcache.configuration.php#ini.opcache.file_update_protection
shivashanti commentedon Feb 10, 2019
I think it will improve even with
LOCK_EX, Probably not enough forLOCK_EX.The code generating process needs to create a temporary file and mv it.
Because there is a very very short time from file open to lock. If other process read the file at that time, it will appear as an empty.