Skip to content

Commit b2899a6

Browse files
committed
bug symfony#16312 [HttpKernel] clearstatcache() so the Cache sees when a .lck file has been released (mpdude)
This PR was squashed before being merged into the 2.3 branch (closes symfony#16312). Discussion ---------- [HttpKernel] clearstatcache() so the Cache sees when a .lck file has been released | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#15813 | License | MIT | Doc PR | n/a I've been trying to debug symfony#15813 and modified the Store in a way to keep unique request IDs in the .lck file. That way, I was hoping to find out which request is blocking and/or if the request is actually still running. It turned out that `is_file()` would claim that a lock file still exists, but a subsequent attempt to read the information from that file returned "file not found" errors. So, my assumption is that the `is_file()` result is based on the fstat cache and wrong once a process has seen the lock file. @jakzal said in symfony#15813 (comment) that `unlink()`ing the lock file should clear the statcache, but I doubt this is true across PHP processes. Commits ------- 982710f [HttpKernel] clearstatcache() so the Cache sees when a .lck file has been released
2 parents 59b782a + 982710f commit b2899a6

File tree

1 file changed

+4
-1
lines changed
  • src/Symfony/Component/HttpKernel/HttpCache

1 file changed

+4
-1
lines changed

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ public function unlock(Request $request)
110110

111111
public function isLocked(Request $request)
112112
{
113-
return is_file($this->getPath($this->getCacheKey($request).'.lck'));
113+
$path = $this->getPath($this->getCacheKey($request).'.lck');
114+
clearstatcache(true, $path);
115+
116+
return is_file($path);
114117
}
115118

116119
/**

0 commit comments

Comments
 (0)