Page MenuHomePhabricator

incorrect rollback reports
Closed, ResolvedPublic

Description

Author: dannychia

Description:
I've noticed that if I revert a page using rollback and another user reverts the page right before me, it would often tell me that I reverted the page, even though I did not.


Version: unspecified
Severity: normal

Details

Reference
bz12873

Event Timeline

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

dannychia wrote:

It is a bit hard to explain, but here is an example. Suppose that there is a vandal (Mallory) and two users with rollback access (Alice and Bob).

Mallory vandalizes a page, and both Alice and Bob try to revert it, with Alice beating Bob by about a second. When Bob tries to revert the page, he may get a message telling him that he reverted the page, instead of one saying that the page has already been reverted.

(In reply to comment #2)

It is a bit hard to explain, but here is an example. Suppose that there is a
vandal (Mallory) and two users with rollback access (Alice and Bob).

Mallory vandalizes a page, and both Alice and Bob try to revert it, with Alice
beating Bob by about a second. When Bob tries to revert the page, he may get a
message telling him that he reverted the page, instead of one saying that the
page has already been reverted.

I know the rollback code pretty well, and this is close to impossible. Every rollback link contains a token, which is basically a number calculated using your session ID, the name of the page and the name of the user who last edited the page. If someone edits the page between you viewing the history page and clicking the rollback link, the latter of those three will have changed and the token will be invalid, triggering an error like "we could not process your request due to a loss of session data. Please try again".

It would, of course, be theoretically possible that an edit was saved between checking the token and actually committing the rollback. However, such race conditions are more or less inevitable. We could add a paranoia check right before committing the rollback, though. Thoughts?

(In reply to comment #3)

If someone edits the page between you viewing the history page and
clicking the rollback link, the latter of those three will have changed and the
token will be invalid, triggering an error like "we could not process your
request due to a loss of session data. Please try again".

I looked more closely and it's not exactly like that, it's even better. The name of the user whose edits you're rolling back is also included in the rollback link, and is compared to the name of the user who last edited the page. If they're not the same, the [[MediaWiki:alreadyrolled]] error message is output. Unfortunately, this information is retrieved from the slave, so this bug would be caused by replag. Maybe Revision::newFromTitle() should have a parameter indicating whether to load from master or slave?

dannychia wrote:

It seems that the rollback code is partially correct.

On the English Wikipedia, there are several instances where ClueBot (a very fast anti-vandalism bot) beats me to the revert. I sometimes get the following message:

"Reverted edits by <vandal>; changed back to last version by ClueBot."

The software recognizes that ClueBot has edited the page, but it does not realize that I wasn't the one that reverted it. If I go back and click the "rollback" link again, it gives the correct "unable to proceed" message.

Please check that the history isn't something like:

Vandal: more vandalism
Vandal: vandalism
ClueBot: reverted Vandal2 <--- this is the rev you're reverting to
Vandal2: vandalism

In that case, the message would be correct.

Of course, it's possible that this is a race condition, maybe we should add a paranoia check just before rolling back.

  • Bug 17350 has been marked as a duplicate of this bug. ***

Should be fixed with gerrit 102550