[Mediawiki-l] Weirdest MediaWiki debug session ever! (random article parsing)

Daniel Barrett danb at VistaPrint.com
Fri Jul 22 14:55:49 UTC 2011

I just encountered the strangest MediaWiki behavior I've ever tried to debug. Thought you'd find it interesting.  (MediaWiki gurus: is the behavior & solution below new in 1.17.0?) I spent several hours figuring this out.

After installing MW 1.17, I noticed that every page on our wiki was throwing an identical error. The exact details of the error aren't important (an extension was invoking an external Linux command that was failing). The weird part was this: only ONE page on the wiki invoked this extension and could possibly produce the error... but that page was never being hit! At all! And EVERY wiki page was producing the error. Even special pages! This was really strange.

The page was Template:Foo. So I figured, naturally, that Template:Foo must be getting transcluded by a system message or some other article used on every page.  That turned out to be wrong.

So I removed all extensions except the one throwing the error. Nothing changed. So it's not caused by an interaction between extensions.

So, I found the line of code where the error was being thrown and inserted a var_dump(debug_backtrace()) to see what's going on. And now it got even weirder. Every time any wiki page was displayed, it was not just transcluding Template:Foo.  It was parsing a RANDOM ARTICLE that contains Template:Foo.  Each time I displayed any wiki page, a different random article would get parsed, and they all transcluded Template:Foo.  Wild!

At this point, I was very confused.

Until I noticed that the "random articles" being selected for parsing were being picked in alphabetical order.

Any guesses? :-)

My coworker figured it out, or at least he has an idea that is consistent with the facts. Because Template:Foo is throwing an error, all pages that transclude it are failing to render. Which (probably) means they are being added to the MediaWiki job queue for reparsing.  So when any wiki page is hit, an article on the MediaWiki job queue is being processed. It fails again, throwing the error.

So, Template:Foo was not being used by the currently displayed article at all. It was being parsed via the job queue afterward.

Did something change in 1.17.0 with job queue processing to make this behavior happen, or at least make it more visible in the apache error log?


More information about the MediaWiki-l mailing list