Fatal errors when using xxlimit=max
Closed, ResolvedPublic

Description

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
URL: http://en.wikipedia.org/w/api.php?action=query&cllimit=max&format=yamlfm&prop=categories&titles=Test

bzimport added a project: MediaWiki-API.Via ConduitNov 21 2014, 11:08 PM
bzimport set Reference to bz24564.
Anomie created this task.Via LegacyJul 28 2010, 3:28 AM
bzimport added a comment.Via ConduitJul 28 2010, 3:44 AM

overlordq wrote:

Backtrace if it helps: http://pastebin.ca/WtfmbvfF

password is pants

tstarling added a comment.Via ConduitJul 28 2010, 4:27 AM

Fixed.

bzimport added a comment.Via ConduitJul 28 2010, 7:53 AM

overlordq wrote:

Re-opening as problem still occurs[1] if using generators as pointed out[2] in the mailing list.

1 - http://en.wikipedia.org/w/api.php?gbltitle=American&prop=info&action=query&generator=backlinks&gbllimit=max
2 - http://lists.wikimedia.org/pipermail/mediawiki-api/2010-July/001896.html

tstarling added a comment.Via ConduitJul 28 2010, 7:57 AM

Too late, it's released now.

bzimport added a comment.Via ConduitJul 28 2010, 11:17 AM

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.

bzimport added a comment.Via ConduitJul 28 2010, 11:33 AM

Bryan.TongMinh wrote:

Fixed in r70078, needs deployment.

Anomie added a comment.Via ConduitJul 28 2010, 11:44 AM

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.

Raymond added a comment.Via ConduitJul 28 2010, 3:28 PM
  • Bug 24571 has been marked as a duplicate of this bug. ***
tstarling added a comment.Via ConduitJul 30 2010, 5:42 AM

It's deployed now.

Add Comment