Bug #32282
closedtypo3temp/locks warning. unlink function returns warning
100%
Description
php unlink() function returns a warning when the file does not exist.
Obtained warning:
---
Core: Error handler (FE): PHP Warning: unlink(/.../.../typo3temp/locks/107c9b0324ec9db67812eb6af3e78732) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /usr/local/src/typo3/typo3_src-4.5.8/t3lib/class.t3lib_lock.php line 210
We should test the $this->resource variable by file_exists() php function before unlinking.
if (unlink($this->resource) == FALSE) {
Files
Updated by Gerrit Code Review almost 13 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7052
Updated by Xavier Perseguers almost 13 years ago
I've seen this behaviour and I'm currently trying to figure out what the cause is. I suspect some race condition.
Updated by Björn Pedersen almost 13 years ago
This is a race condition reported here already:
http://forge.typo3.org/issues/24342
Updated by Xavier Perseguers almost 13 years ago
There is indeed a problem that appears when the lock file could not be acquired, as reported in this syslog (after slightly modifying Core to add additional information):
05-12-11 15:24 - cms: Locking: Failed to acquire lock: Lock file could not be created (/path/to/typo3temp/locks/f288221509d8f33b8e85fbfd25731733) 05-12-11 15:24 - Core: Error handler (FE): PHP Warning: unlink(/path/to/typo3temp/locks/ f288221509d8f33b8e85fbfd25731733) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /path/to/t3lib/class.t3lib_lock.php line 21
The non-acquired lock-file is then "unlinked" by taking for granted that it exists. By quickly digging into the code, I'd say that fixing that would require quite some refactoring of t3lib_lock, refactoring that is supposed to happen with #24342 but was forgotten (as not pushed forwards) for 4.6, thus hopefully something for 4.7.
Anyway, I would suggest to simply test for file existence before unlinking it but not hide the warning with an @ sign in front of unlink.
Updated by Razakanirina almost 13 years ago
Does testing if file exists solve the race condition problem? Does it related to the php unlink() function?
Updated by Helmut Hummel almost 13 years ago
- Status changed from Under Review to Needs Feedback
For those who have problems with the unlink warning message:
What is your max_execution_time setting?
The only reace condition which is clearly there is because of deleting stale lock files.
Updated by Helmut Hummel almost 13 years ago
I added a small extension to reproduce the problem.
Install it, then execute the following command line:
wget -qO- "http://typo3.dev/index.php?eID=locktest&number=first" & sleep 2; wget -qO- "http://typo3.dev/index.php?eID=locktest&number=second"
The problem will occur, when the max_execution_time is relatively low (forced to be 1 second in the extension), but the request itself takes longer than the max_execution_time
This may well happen because max_execution_time only reflects the PHP script execution times but excludes the time that is consumed by single commands (like sleep or other system commands)
Updated by Xavier Perseguers almost 13 years ago
What about adding the @ sign in front of unlink instead of testing with file_exists. I'd say that even if not "that clean", it will prevent perform 2 accesses for the file system in most cases...
Updated by Gerrit Code Review over 12 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/9612
Updated by Markus Klein over 12 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 9ea4e973edac575cd4138ff9082f06d53037a1c4.
Updated by Gerrit Code Review over 12 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/12831
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/12832
Updated by Markus Klein over 12 years ago
- Status changed from Under Review to Resolved
Applied in changeset 1e11fd1d563bb4ffdcb6a4496a7b3f473a1da76d.
Updated by Gerrit Code Review over 12 years ago
- Status changed from Resolved to Under Review
Updated by Oliver Hader over 12 years ago
- Status changed from Under Review to Resolved