Page MenuHomePhabricator

Could not acquire lock when uploading a new version of an existing file
Closed, ResolvedPublic

Description

Author: beta

Description:
When uploading a new version of an existing file.
I always got the following message:

Could not acquire lock for key "est5rsvfknamj8y9bqldhv8tszzpfqe".

Version: 1.20.x
Severity: normal
OS: Windows Server 2003
Platform: PC

Details

Reference
bz33294

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:03 AM
bzimport set Reference to bz33294.
bzimport added a subscriber: Unknown Object (MLST).

tagging for platformeng to see if anyone can repro a non-windows platform.

[mid-air collision] cc'ing aaron since this is presumably file backend related (they did say 1.19-svn in version field).

beta wrote:

Update my environment information as below:

OS: Windows Server 2008 R2
MediaWiki: 1.19alpha (r106928)
PHP: 5.3.6 (apache2handler)
Database: PostgreSQL 8.3.14

Thanks for your help!

(In reply to comment #0)

When uploading a new version of an existing file.
I always got the following message:

Could not acquire lock for key "est5rsvfknamj8y9bqldhv8tszzpfqe".

Does this happen when uploading a file under a name that nothing uses?

beta wrote:

(In reply to comment #4)

Does this happen when uploading a file under a name that nothing uses?

No, I can upload file with a brand-new name.

Can you test a bit of PHP code, e.g.:
$fp1 = fopen( <path to a file in a dir that exists>, 'a ' );
$ok1 = flock( $fp1, LOCK_SH | LOCK_NB );
$fp2 = fopen( <path to same file>, 'a ' );
$ok2 = flock( $fp2, LOCK_EX | LOCK_NB );

And look at $ok1/$ok2.

You can also test MW before and after r106935 to see if that helps.

beta wrote:

(In reply to comment #6)

Can you test a bit of PHP code, e.g.:
...
And look at $ok1/$ok2.

I added following code into FSLockManager.php, and my php-errors.log shows:

[21-Dec-2011 18:10:23] $ok1: "1"
[21-Dec-2011 18:10:23] $ok2: ""

Sorry that I know almost nothing about php...

  • FSLockManager.php (revision 106928)

FSLockManager.php (working copy)
@@ -94,6 94,15 @@

					$this->handles[$key][$type] = $handle;
				} else {
					fclose( $handle );


$fp1 = fopen( 'D:\\App\\mediawiki\\images\\5\\5d\\redmine_mylyn_03_add_repository.png', 'a ' );
$ok1 = flock( $fp1, LOCK_SH | LOCK_NB );
$fp2 = fopen( 'D:\\App\\mediawiki\\images\\5\\5d\\redmine_mylyn_03_add_repository.png', 'a ' );
$ok2 = flock( $fp2, LOCK_EX | LOCK_NB );

error_log('$ok1: "'.$ok1.'"');
error_log('$ok2: "'.$ok2.'"');

					$status->fatal( 'lockmanager-fail-acquirelock', $key );
				}
			} else {

beta wrote:

(In reply to comment #7)

You can also test MW before and after r106935 to see if that helps.

I can finally upload the file after updating to r106935.
Thanks for your help!!

Gilles raised the priority of this task from Medium to Unbreak Now!.Dec 4 2014, 10:29 AM
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Medium.Dec 4 2014, 11:22 AM