Topic on Project:Support desk

Exception from line 1871 of /w/includes/filerepo/file/LocalFile.php: Could not acquire lock for 'npose_n.png.'

11
Summary by Ciencia Al Poder

Problem is always wrong permissions in filesystem, or misconfiguration of SELinux

184.155.109.183 (talkcontribs)

/Special:Upload Exception from line 1871 of /w/includes/filerepo/file/LocalFile.php: Could not acquire lock for 'npose_n.png.'

^I get that error when attempting to upload ANY file. Nothing I do is able to prevent this from happening.

1. What's a lock? 2. Why would this even happen? 3. What can I do to fix it?

It's very, very weird.

Florianschmidtwelzow (talkcontribs)

MediaWiki tries to acquire an exclusive (or shared) lock to a file, which means, that MediaWiki wants to prevent any access to a given file, until the actions of MW are finished. Read more about file locking.

To fix this problem, we must find out, what the problem is :) Is your webserver allowed to read/write the directory, where your images will be saved?

88.130.92.109 (talkcontribs)

This error happens when a file should get locked for an update, but it can't be locked. A lock is used to prevent other changes to the file/the associated database row. The code, which now is failing got introduced to fix https://bugzilla.wikimedia.org/show_bug.cgi?id=54736.

Questions are:

  • Which version of MediaWiki are you using?
  • You say that you get this error for every file. Does it then always contain the filename 'npose_n.png.' or does the filename change?
  • Am I right thinking that the filename (in your example 'npose_n.png.') misses the first few letters?
Sezgin İbiş (talkcontribs)

[2640d8bf] /index.php?title=%C3%96zel:Y%C3%BCkle Exception from line 1871 of /usr/share/nginx/html/includes/filerepo/file/LocalFile.php: Could not acquire lock for 'Yazanadam.jpg.'

Backtrace:

  1. 0 /usr/share/nginx/html/includes/filerepo/file/LocalFile.php(1174): LocalFile->lock()
  2. 1 /usr/share/nginx/html/includes/upload/UploadBase.php(738): LocalFile->upload(string, string, string, integer, array, boolean, User)
  3. 2 /usr/share/nginx/html/includes/specials/SpecialUpload.php(467): UploadBase->performUpload(string, string, boolean, User)
  4. 3 /usr/share/nginx/html/includes/specials/SpecialUpload.php(186): SpecialUpload->processUpload()
  5. 4 /usr/share/nginx/html/includes/specialpage/SpecialPage.php(363): SpecialUpload->execute(NULL)
  6. 5 /usr/share/nginx/html/includes/specialpage/SpecialPageFactory.php(584): SpecialPage->run(NULL)
  7. 6 /usr/share/nginx/html/includes/MediaWiki.php(275): SpecialPageFactory::executePath(Title, RequestContext)
  8. 7 /usr/share/nginx/html/includes/MediaWiki.php(584): MediaWiki->performRequest()
  9. 8 /usr/share/nginx/html/includes/MediaWiki.php(435): MediaWiki->main()
  10. 9 /usr/share/nginx/html/index.php(46): MediaWiki->run()
  11. 10 {main}

Version: MediaWiki 1.24.0

87.229.231.234 (talkcontribs)

This error is for every file, wiki 1.24. Permissions 777 for all already ...

89.242.167.212 (talkcontribs)

I first changed the permission on the wiki folder itself to allow "others" read and write permissions, this didn't propagate to the subfolders, so I changed permissions for others on all the subfolders (and made sure to propagate the change - Ubuntu makes it easy). After that I was able to upload files without any problems.

TheDJ (talkcontribs)

Note that giving write permissions to 'others' (which the last 7 means) is dangerous. You should make sure that everything is no more than 775. If that doesn't work, then most likely the owner or group of some of the files is incorrect.

80.254.150.43 (talkcontribs)

Hi i have the same issue. I found an tip in the httpd:error_log (in var/log/httpd) which tells me that the directory images/lockdir can't be created as a repository to lock files.
So i created it manually.
After that another message => Impossible de créer le dossier « mwstore://local-backend/local-public/e/e0 ». (fr)
Do i have to upload a plugin in my mediawiki for this feature ?

80.254.150.43 (talkcontribs)

The pb was solved giving rights to the directories to the apache user (forgotten i think while i installed it).
In my wiki dir : find . -type d -exec chown apache.apache {} \; May be add chmod for more permissions on these dirs ?

Beinan557 (talkcontribs)

I also have this problem, I would like to ask how to solve!

[4fcd73c1] /index.php/%E7%89%B9%E6%AE%8A:%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6 MWException from line 1868 of /home/mediawiki/wiki/includes/filerepo/file/LocalFile.php: Could not acquire lock for '78px-Demonic_Blade_Vortex_Effect.png.'

Backtrace:

#0 /home/mediawiki/wiki/includes/filerepo/file/LocalFile.php(1147): LocalFile->lock()

#1 /home/mediawiki/wiki/includes/upload/UploadBase.php(708): LocalFile->upload(string, string, string, integer, array, boolean, User)

#2 /home/mediawiki/wiki/includes/specials/SpecialUpload.php(486): UploadBase->performUpload(string, string, boolean, User)

#3 /home/mediawiki/wiki/includes/specials/SpecialUpload.php(197): SpecialUpload->processUpload()

#4 /home/mediawiki/wiki/includes/specialpage/SpecialPage.php(384): SpecialUpload->execute(NULL)

#5 /home/mediawiki/wiki/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)

#6 /home/mediawiki/wiki/includes/MediaWiki.php(281): SpecialPageFactory::executePath(Title, RequestContext)

#7 /home/mediawiki/wiki/includes/MediaWiki.php(714): MediaWiki->performRequest()

#8 /home/mediawiki/wiki/includes/MediaWiki.php(508): MediaWiki->main()

#9 /home/mediawiki/wiki/index.php(41): MediaWiki->run()

#10 {main}

This post was hidden by 50.192.136.241 (history)