Last modified: 2014-11-11 18:32:53 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T55791, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 53791 - update.php leaves unopenable UIDGenerator lock file
update.php leaves unopenable UIDGenerator lock file
Status: NEW
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-05 05:36 UTC by spage
Modified: 2014-11-11 18:32 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description spage 2013-09-05 05:36:19 UTC
This is related to bug 44850.

When I run `php maintenance/update.php` to install the Flow extension, it creates temp files
  -rw-rw-r-- 1 spage wikidev 28 2013-08-29 06:46 /tmp/mw-UIDGenerator-UID-128
  -rw-rw-r-- 1 spage wikidev 12 2013-08-29 06:46 /tmp/mw-UIDGenerator-UID-nodeid

then, when I try to access a page like Special:Flow/Sandbox, PHP fails with

Could not open '/tmp/mw-UIDGenerator-UID-128'.
Backtrace:

#0 /srv/mediawiki/includes/UIDGenerator.php(150): UIDGenerator->getTimestampAndDelay('lockFile128', 16384, 1048576)
#1 /srv/mediawiki/extensions/Flow/includes/Model/UUID.php(31): UIDGenerator::newTimestampedUID128(16)
#2 /srv/mediawiki/extensions/Flow/includes/Model/Workflow.php(73): Flow\Model\UUID::create()

the workaround is to remove these files after running update.php

It would be better if update cleaned up, or if UIDGenerator could clean up at termination it would fix bug 44850 as well.
Comment 1 Nemo 2014-03-19 16:36:20 UTC
Still current. We just got this again, on terbium, with the /usr/local/bin/characterEditStatsTranslate script for bug 58440. The script is run as mwdeploy:mwdeploy and has read permission, but not write permission, on that file, currently dated Mar 16 20:02.

Warning: fopen(/tmp/mw-UIDGenerator-squidhtcppurge-48): failed to open stream: Permission denied in
                  /usr/local/apache/common-local/php-1.23wmf18/includes/utils/UIDGenerator.php on line 296
[7e60e1e9] [no req]   Exception from line 301 of
                  /usr/local/apache/common-local/php-1.23wmf18/includes/utils/UIDGenerator.php: Could not open
                  '/tmp/mw-UIDGenerator-squidhtcppurge-48'.
Backtrace:
#0 /usr/local/apache/common-local/php-1.23wmf18/includes/utils/UIDGenerator.php(247):
                  UIDGenerator->getSequentialPerNodeIDs(string, integer, integer, integer)
#1 /usr/local/apache/common-local/php-1.23wmf18/includes/deferred/SquidUpdate.php(222):
                  UIDGenerator::newSequentialPerNodeIDs(string, integer, integer, integer)
#2 /usr/local/apache/common-local/php-1.23wmf18/includes/deferred/SquidUpdate.php(145): SquidUpdate::HTCPPurge(array)
#3 /usr/local/apache/common-local/php-1.23wmf18/includes/deferred/SquidUpdate.php(124): SquidUpdate::purge(array)
#4 /usr/local/apache/common-local/php-1.23wmf18/includes/Title.php(3604): SquidUpdate->doUpdate()
#5 /usr/local/apache/common-local/php-1.23wmf18/includes/WikiPage.php(3128): Title->purgeSquid()
#6 /usr/local/apache/common-local/php-1.23wmf18/includes/WikiPage.php(2210): WikiPage::onArticleEdit(Title)
#7 /usr/local/apache/common-local/php-1.23wmf18/includes/WikiPage.php(1874): WikiPage->doEditUpdates(Revision, User, array)
#8 /usr/local/apache/common-local/php-1.23wmf18/maintenance/edit.php(90): WikiPage->doEditContent(WikitextContent, string,
                  integer)
#9 /usr/local/apache/common-local/php-1.23wmf18/maintenance/doMaintenance.php(104): EditCLI->execute()
#10 /usr/local/apache/common-local/php-1.23wmf18/maintenance/edit.php(106): require_once(string)
#11 /usr/local/apache/common-local/multiversion/MWScript.php(97): require_once(string)
#12 {main}
Comment 2 Marius Hoch 2014-03-27 17:48:10 UTC
(In reply to Nemo from comment #1)
> Still current. We just got this again, on terbium, [...]

The terbium issues have been resolved locally for now, let's hope that this won't come back.
Comment 3 Gerrit Notification Bot 2014-03-27 22:35:45 UTC
Change 121549 had a related patch set uploaded by BryanDavis:
Make UIDGenerator cache files world writable

https://gerrit.wikimedia.org/r/121549
Comment 4 Gerrit Notification Bot 2014-04-08 23:19:02 UTC
Change 121549 abandoned by BryanDavis:
Make UIDGenerator cache files world writable

Reason:
Aaron and Chris are right in pointing out that this is not a good way to solve this problem. For production hosts we should never see this issue if mwscript is being used to execute all maintenance scripts.

If we do have file ownership problems on a production host that can be traced to UIDGenerator cache file permissions that should be treated as toolchain problem to be resolved by ensuring that the proper wrapper scripts are being used.

https://gerrit.wikimedia.org/r/121549
Comment 5 Bryan Davis 2014-04-08 23:39:57 UTC
For production hosts we should never see this issue if mwscript is being used to execute all maintenance scripts. If we do have file ownership problems on a production host that can be traced to UIDGenerator cache file permissions that should be treated as toolchain problem to be resolved by ensuring that the proper wrapper scripts are being used.

The problem S ran into looks to be on a local/vagrant/labs dev server. I think the best answer for this is to advocate good script execution hygiene. I don't know if there is a good way to enforce this programmatically, but wiki maintenance scripts should always be run as the web server user (usually www-data on Ubuntu using Apache). If you run a maintenance script as a more privileged user you run the risk of executing malicious code that could do any number of nasty things as "you".

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links