#015922: File backend lock function expects lock timeout argument as seconds, milliseconds passed

Description:

    public function lock( $waitTime, $timeout )
    {
    ...    
        while ( ( $fp = @fopen( $lockFileName, 'x' ) ) === false )
        {
            // This is untestable.
            if (** microtime( true ) - $lockStart **> $timeout )
            {
                // Release timed out lock
                unlink( $lockFileName );
                $lockStart = microtime( true );
            }
            else
            {
                usleep( $waitTime );
            }
        }

The function gets milliseconds as $timeout, but the highlighted text will return seconds.


Environment:

Operating System: Linux 2.6.31-16-generic #52-Ubuntu SMP
PHP Version: (please be specific, like '4.4.3' or '5.1.5'): 5.2.1
Client: Cadaver


Steps to Reproduce:

1. Create a fake .ezc_lock file in the path to the backend
2. Try to edit any file
3. Will never release and aquire the lock

Also suggesting cleaning up of aquireLock function, the argument is never used, neither is the return parameters afaik.

Supplied a patch for file backend, file backend options (the waitForLock option is no longer used) and file plugin options (set the timeout to seconds instead of milliseconds)


- Attachments
filebackend.patch (2.4 kb)
[Download] [Permanent Link]

- Comments

Fixed in rev. #11422.

#265412 by Tobias Schlitt on March 20th, 2010 [Permanent Link]

Mattis,

thanks for your report and the patch. I did not choose your solution to fix the issue, since this would have made the file back end depend on the lock plugin. However, you can now configure the lock time out individually through ezcWebdavFileBackendOptions.

Regards,
Toby

#265413 by Tobias Schlitt on March 20th, 2010 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » Webdav
Affects Unknown
Fix Version -
Reporter Mattis Stordalen Flister
Responsible Tobias Schlitt
Status 0 Closed
Resolution Fixed
Created December 8th, 2009
Updated March 20th, 2010
Resolved March 20th, 2010
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels