Page MenuHomePhabricator

Fatal errors when using xxlimit=max
Closed, ResolvedPublic


The API on enwiki is now giving fatal errors when the special value "max" is set for the limit parameter of various modules (I've tried prop=categories, revisions, and templates quickly, and all three had the problem). The error message is "Exception Caught: Internal error in ApiResult::setElement: Attempting to add element categories=500, existing value is 500".

In my local installation of Mediawiki, this error occurs with r69776 and does not occur with r69775. I haven't yet attempted to see what exactly in that 1334-line diff might have broken things.

Version: 1.17.x
Severity: critical



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:08 PM
bzimport set Reference to bz24564.

overlordq wrote:

Backtrace if it helps:

password is pants

Bryan.TongMinh wrote:

The problem is:

  1. ApiMain::execute calls extractRequestParams with $parseLimit = true
  2. The limit=max gets parsed and added to the result
  3. ApiQueryBacklinks::run calls extractRequestParams with $parseLimit = false
  4. ApiQueryBacklinks::run calculates its own limit and adds that to the result

I will make a fix where for limits calls overwriting is allowed.

Bryan.TongMinh wrote:

Fixed in r70078, needs deployment.

I was going to suggest changing it to $generator->extractRequestParams( false ) and $module->extractRequestParams( false ) in ApiQuery.php, but I guess that works. Your version also causes bug 21310 to be broken in a different, less annoying way.

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