Page MenuHomePhabricator

Detect conflict on move
Closed, DuplicatePublic

Description

A user on de.wp has seen a move conflict (see URL). Both moves are in the same minute (two second difference). It is possible to check for a conflict here, to reject the 2nd move? Thanks.


Version: unspecified
Severity: normal
URL: http://de.wikipedia.org/w/index.php?title=Flughafen_M%C3%BCnchen&diff=91968874&oldid=91968873

Details

Reference
bz30211

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:51 PM
bzimport set Reference to bz30211.
bzimport added a subscriber: Unknown Object (MLST).

john wrote:

The example is really weird. Both moves are A -> B, however in my tests trying to move A -> B (Open two move windows, submit one after the other), I get an error on the last one about B already existing and asking for my permission (Because I'm a sysop) before deleting B to make way for A. It's possible that there was DB lag which caused for nothing to happen for user 2.

On a similar note, trying to do 2 moves in a similar fashion except as A -> B and A -> C results in a double redirect of A -> C -> B. Probably the best prevention of this is race condition check (Similar to how edit conflicts are handled).

john wrote:

Race condition check

Error message could probably be better worded.

Attached:

It is not enough to check the starttime against the latest revisiontimestamp like EditPage do for normal edit? That means, edit-move conflict is also detected, when someone has edit the page, while a user is trying to move the same page.

The other way round is also interesting (bug 5408, bug 23044).

john wrote:

I didn't think it was worth checking to see if the page has edited. Imo who cares if someone edited the page after you open the form, it doesn't affect the move you're about to do.

sumanah wrote:

Hey John, would you mind putting this in Gerrit? Thanks.

Hi John, would you have time to use Developer access

https://www.mediawiki.org/wiki/Developer_access

to submit this as a Git branch directly into Gerrit:

https://www.mediawiki.org/wiki/Git/Tutorial

Putting your branch in Git makes it easier for us to review it quickly.
Thanks again! We appreciate your contribution.

(In reply to John Du Hart from comment #2)

Created attachment 8910 [details]
Race condition check

Result from uploading patch:
patch -p0 < patch
patching file includes/specials/SpecialMovepage.php
Hunk #1 FAILED at 34.
Hunk #2 succeeded at 93 with fuzz 1 (offset 7 lines).
Hunk #3 succeeded at 136 with fuzz 2 (offset -57 lines).
Hunk #4 FAILED at 336.
Hunk #5 succeeded at 529 (offset 127 lines).
Hunk #6 FAILED at 472.
3 out of 6 hunks FAILED -- saving rejects to file includes/specials/SpecialMovepage.php.rej
patching file languages/messages/MessagesEn.php
Hunk #1 succeeded at 3529 with fuzz 2 (offset 257 lines).
patching file languages/messages/MessagesQqq.php
Hunk #1 FAILED at 2889.
1 out of 1 hunk FAILED -- saving rejects to file languages/messages/MessagesQqq.php.rej
patching file maintenance/language/messages.inc
Hunk #1 succeeded at 2450 (offset 203 lines).

Attached:

Looks that this causes the following traceback. 15:22, 11 July 2019 Michal Bělka talk contribs block moved page František Lydie Gahura to František Lýdie Gahura (s přesměrováním, používají se zjevně obě varianty) (revert) (thank) happened on cs.wp while User:Janbery was moving the same page in the same minute, with the following error.

[XSc4DgpAICsAADlL5JwAAABT] /w/index.php?title=Speci%C3%A1ln%C3%AD:P%C5%99esunout_str%C3%A1nku&action=submit   MWException from line 763 of /srv/mediawiki/php-1.34.0-wmf.11/includes/MovePage.php: Failed to create null revision while moving page ID 262828 to František_Lýdie_Gahura
#0 /srv/mediawiki/php-1.34.0-wmf.11/includes/MovePage.php(452): MovePage->moveToInternal(User, Title, string, boolean, array)
#1 /srv/mediawiki/php-1.34.0-wmf.11/includes/MovePage.php(294): MovePage->moveUnsafe(User, string, boolean, array)
#2 /srv/mediawiki/php-1.34.0-wmf.11/includes/specials/SpecialMovepage.php(610): MovePage->moveIfAllowed(User, string, boolean)
#3 /srv/mediawiki/php-1.34.0-wmf.11/includes/specials/SpecialMovepage.php(130): MovePageForm->doSubmit()
#4 /srv/mediawiki/php-1.34.0-wmf.11/includes/specialpage/SpecialPage.php(571): MovePageForm->execute(NULL)
#5 /srv/mediawiki/php-1.34.0-wmf.11/includes/specialpage/SpecialPageFactory.php(581): SpecialPage->run(NULL)
#6 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#7 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(884): MediaWiki->performRequest()
#8 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(515): MediaWiki->main()
#9 /srv/mediawiki/php-1.34.0-wmf.11/index.php(42): MediaWiki->run()
#10 /srv/mediawiki/w/index.php(3): include(string)
#11 {main}

@Urbanecm: That stacktrace looks like T205675

Hmm, then the fact two users were moving on the same time might be just a coincidence.

Hmm, then the fact two users were moving on the same time might be just a coincidence.

The cause is very likely some kind of race condition. That race condition may also be a problem if only one user is involved, but with two users it's certainly more likely to happen.

Unfortunately, it's still unclear what exactly the race condition is.