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
When a PHP process crashes or terminates (maybe the OOM killer kicks in or other bad things ™️ happen) while the HttpCache holds a .lck file, that lock file may not get unlink()ed.
The result is that other requests trying to access this cache entry will see a few seconds delay while waiting for the lock; they will eventually continue but send 503 status codes along with the response. The sudden buildup of PHP processes caused by the additional delay may cause further problems (sudden load increase).
One solution might be to use the LockHandler from the Filesystem component. It applies flock()-based locking, so the lock will automatically be released when the process holding it terminates.
As the LockHandler was added in 2.6, this is not a bugfix we could provide for 2.3.
(Yes, I've seen this happen quite a few time in practice.)
The text was updated successfully, but these errors were encountered:
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpKernel] Use flock() for HttpCache's lock files
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | #16777, #15813 and #16312 are also related
| License | MIT
| Doc PR |
When a PHP process crashes or terminates (maybe the OOM killer kicks in or other bad things ™️ happen) while the `HttpCache` holds a `.lck` file, that lock file may not get `unlink()`ed.
The result is that other requests trying to access this cache entry will see a few seconds delay while waiting for the lock; they will eventually continue but send 503 status codes along with the response. The sudden buildup of PHP processes caused by the additional delay may cause further problems (sudden load increase).
As `LockHandler` is using `flock()`-based locking, locks should be released by the OS when the PHP process terminates.
I wrote this as bugfix against 2.7 because every once in a while I encounter situations (not always reproducible) where `.lock` files are left over and keep the cache locked.
Commits
-------
2668edd [HttpKernel] Use flock() for HttpCache's lock files
This is a follow-up for #15813 (comment).
When a PHP process crashes or terminates (maybe the OOM killer kicks in or other bad things ™️ happen) while the
HttpCache
holds a.lck
file, that lock file may not getunlink()
ed.The result is that other requests trying to access this cache entry will see a few seconds delay while waiting for the lock; they will eventually continue but send 503 status codes along with the response. The sudden buildup of PHP processes caused by the additional delay may cause further problems (sudden load increase).
One solution might be to use the
LockHandler
from the Filesystem component. It appliesflock()
-based locking, so the lock will automatically be released when the process holding it terminates.As the
LockHandler
was added in 2.6, this is not a bugfix we could provide for 2.3.(Yes, I've seen this happen quite a few time in practice.)
The text was updated successfully, but these errors were encountered: