Page MenuHomePhabricator

MediaWiki unable to compute page diff
Closed, ResolvedPublic

Description

Author: gareth.rees

Description:
See the quoted URL. MediaWiki is unable to compute this diff. When I try to load this page I get the error
message:

Fatal error [host=]: Maximum execution time of 30 seconds exceeded in /usr/local/apache/common-
local/php-new/includes/DifferenceEngine.php on line 436

On my local machine a "diff" of the corresponding page sources takes 0.03 seconds. This suggests that
there is a bug in the MediaWiki diff implementation.

The effect of this bug is that it may be impossible to figure out what has changed between two revisions
of a page. A clever vandal could exploit this bug to cover their tracks.


Version: unspecified
Severity: major
URL: http://en.wikipedia.org/w/wiki.phtml?title=List_of_Royal_Navy_ship_names&diff=7753945&oldid=7752484

Details

Reference
bz932

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:04 PM
bzimport set Reference to bz932.
bzimport added a subscriber: Unknown Object (MLST).

Testing this page on my test box at home (Athlon XP 2400+) in MediaWiki 1.4:

Using the new wikidiff module (C++ reimplementation of the diff code), the diff
takes about 0.5 second (on top of the page rendering overhead), which is slower
than it could be but not too awful. The PHP version (roughly the same code as in
1.3) takes a whopping *41.5* seconds if allowed to run to completion.

They don't give exactly the same output, but both are highlighting a huge number
of changed lines; looking closer, the first revision in that diff has a space at the end
of nearly every line; in the second it's been removed. Thus some couple of thousand
lines get individually diff'ed up.

gareth.rees wrote:

Perhaps it's not sensible to do this kind of heavy processing in PHP?

(In reply to comment #2)

Perhaps it's not sensible to do this kind of heavy processing in PHP?

Hence the C++ plugin version. It's probably possible to make the PHP code
much more efficient, though.

Note that this is a pathological case: thousands of paragraphs/lines
changed where typically one gets just a few. Even a longish article like
[[Zuiderzee Works]] is under two hundred lines, and a massive change
(removal of all link brackets) on that page diffs in about 0.7 seconds on the
PHP version on the same box. This particular diff has one order of
magnitude more lines, but takes two orders of magnitude longer to run.

Most of the time on this diff is spent in the loop in _DiffEngine::_diag(),
when it's running over a couple of massive chunks of adjacent lines.

gareth.rees wrote:

MediaWiki 1.4 still can't show the diff. However, it now shows how far it got
(about three quarters of the way through the page), before producing the error:

Fatal error: Maximum execution time of 30 seconds exceeded in /usr/local/apache/common-local/php-1.4/
includes/DifferenceEngine.php on line 614

dbenbenn wrote:

See

http://en.wikipedia.org/w/index.php?
title=User_talk:172.167.41.108&diff=17682235&oldid=15415533

for another failed page diff. The page shrank by 1.3 MBytes,
and the diff fails almost immediately with

Fatal error: Allowed memory size of 100000000 bytes exhausted

Presumably diffing a 1MB file shouldn't require 100MB of memory?

zigger wrote:

Trying the [[List_of_Royal_Navy_ship_names]] example link gave the page text:

Sorry- we have a problem...
The wikimedia web server didn't return any response to your request.
To get information on what's going on you can visit #wikipedia.
An "offsite" status page is hosted on OpenFacts.
Generated Wed, 29 Jun 2005 18:47:49 GMT by srv5.wikimedia.org
(squid/2.5.STABLE9.wp20050410.S9plus[icpfix,nortt,htcpclr])

But trying to view the source of the error page shows this instead:

<br />
<b>Parse error</b>: parse error, unexpected '=', expecting ')' in
<b>/usr/local/apache/common-local/php-1.5/InitialiseSettings.php</b> on line
<b>54</b><br />

zigger wrote:

(In reply to comment #7)

<b>Parse error</b>: parse error, unexpected '=', expecting ')' in
<b>/usr/local/apache/common-local/php-1.5/InitialiseSettings.php</b> on line
<b>54</b><br />

The parse error has since been reported by Guy M at bug 2617.

gareth.rees wrote:

MediaWiki 1.5 can now display the diff! Thank you.