An error occurred when deleting the cache file
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 361
- Avg merge
- 3d 41m
- Merged PRs (30d)
- 2
Description
When multiple requests are sent to the server at the same time. The following error occurs.
Why is it not checked that the file exists when the file is about to be deleted?
Is it possible that an earlier process has deleted the file in processes that occur simultaneously?
while (false !== ($filename = readdir($dh))) {
if (empty($filename)) {
continue;
}
if ($filename[0] === '.') {
continue;
}
$key = substr($filename, 0, strlen($filename) - 4);
if ($this->isOld($key, $config)) {
unlink($dir . '/' . $filename);
}
}
Why package version 4.17 registered but cache file version is 4.15?
class HTMLPurifier_Config
{
/**
* HTML Purifier's version
* @type string
*/
public $version = '4.17.0';
}
Web server: nginx
Php : 8.2
Package: "ezyang/htmlpurifier": "^4.17.0"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the cache cleanup loop containing readdir(), isOld(), and unlink(), then inspect how concurrent requests and the reported package/cache versions are handled. Reproduce the deletion error with multiple simultaneous requests; done means the failure is understood and the cache cleanup behaves correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100