[TYPO3-core] Could not acquire lock for ClassLoader cache creation

Peter Russ peter.russ at 4many.net
Wed May 7 23:59:03 CEST 2014


--- Original Nachricht ---
Absender: Markus Klein
Datum: 07.05.2014 22:19:
> Hi!
>
>>> Brian Lynch wrote:
>>>
>>>> Any thoughts on this?
>>> Well, this is how simple locking works. There is an empty file created
>>> to notice further processes that a critical operation is in progress.
>>> After that, the file should be deleted. Then the next process can take
>>> the lock and do a critical operation.
>>>
>>> The questions is why the file is not deleted.
>>>
>> Perhaps PHP execution time is limited to 30 secs and the process dies before
>> it can delete the file.
>> This would indicate that there is a feature missing after which time an other
>> process would get the lock...
> Actually this feature is present for ages and looks like this:
>
> if (file_exists($this->resource)) {
> 	$this->sysLog('Waiting for a different process to release the lock');
> 	$maxExecutionTime = (int)ini_get('max_execution_time');
> 	$maxAge = time() - ($maxExecutionTime ?: 120);
> 	if (@filectime($this->resource) < $maxAge) {
> 		@unlink($this->resource);
> 		$this->sysLog('Unlinking stale lockfile');
> 	}
> }
>
> So there is something wrong with the file. Either the filectime() is incorrect (which I rather doubt) or the unlink() does not work.
>
> I suggest to go into this file: typo3/sysext/core/Classes/Locking/Locker.php
> Line 275: Remove the @ there and watch the error log and/or the output.

Locking like this is ideal for raise conditions is a multi-server 
environment with NFS. NFS has "some" delay to synch between different 
machines.
So under heavy load it happens that different processes can get the 
lock. Something a single place developer will never experience.
But happena on enterprise solutions.
To avoid this memcache is a better place to handle the lock.

jm2c.

Peter.

-- 
Fiat lux! Docendo discimus.
_____________________________

http://www.xing.com/profile/Peter_Russ



More information about the TYPO3-team-core mailing list