Page MenuHomePhabricator

internal_api_error_DBQueryError when query for logevents
Open, Needs TriagePublicBUG REPORT

Description

This seems to happen just with this single user and is reproducable, it worked for sure on December 31th

wget -O - -q "https://de.wikipedia.org/w/api.php?format=json&formatversion=2&action=query&list=logevents&leprop=timestamp&leuser=Triebt%C3%A4ter&lelimit=1" | jq .
{
  "error": {
    "code": "internal_api_error_DBQueryError",
    "info": "[68632123-b1af-45fd-85aa-b4237fc6ea67] Caught exception of type Wikimedia\\Rdbms\\DBQueryError",
    "errorclass": "Wikimedia\\Rdbms\\DBQueryError"
  },
  "servedby": "mw1358"
}

The same query with a different user with "umlauts" which also is inactive since 2010 works fine

wget -O - -q "https://de.wikipedia.org/w/api.php?format=json&formatversion=2&action=query&list=logevents&leprop=timestamp&leuser=C.L%C3%B6ser&lelimit=1" | jq .
{
  "batchcomplete": true,
  "continue": {
    "lecontinue": "20100317095237|21879267",
    "continue": "-||"
  },
  "query": {
    "logevents": [
      {
        "timestamp": "2010-03-17T09:53:54Z"
      }
    ]
  }
}

Details

Event Timeline

(Unrelated to the API Platform; removing tag)

it worked for sure on December 31th

The current behavior is an intended outcome of T297708: Set max execution time for several expensive mediawiki actions.

"info": "[68632123-b1af-45fd-85aa-b4237fc6ea67] Caught exception of type Wikimedia\\Rdbms\\DBQueryError",

Error 1969: Query execution was interrupted (max_statement_time exceeded) (db1161)
Function: ApiQueryLogEvents::execute
Query: SET STATEMENT max_statement_time=30 FOR SELECT  log_id,log_type,log_action,log_timestamp,log_deleted  FROM `logging` JOIN `actor` ON ((actor_id=log_actor)) LEFT JOIN `page` ON ((log_namespace=page_namespace) AND (log_title=page_title))   WHERE (log_type NOT IN ('spamblacklist','titleblacklist','urlshortener','abusefilterprivatedetails','oath','suppress')) AND actor_name = 'Triebtäter' AND ((log_deleted & 4) != 4)  ORDER BY log_timestamp DESC,log_id DESC LIMIT 2

There should be more friendly message, both on User Interface and API if this is caused by query timeout. Currently it gives technical message.

The message is not a Problem.

The funny thing, which I just found out: Removing the lelimit parameter … and voila … it works fine

https://de.wikipedia.org/w/api.php?action=query&format=json&list=logevents&revids=&formatversion=2&leuser=Triebt%C3%A4ter

Strange behaviour!

Setting lelimit to 4 (or larger) works fine

wget -O - -q "https://de.wikipedia.org/w/api.php?format=json&formatversion=2&action=query&list=logevents&leprop=timestamp&leuser=Triebt%C3%A4ter&lelimit=4" | jq .

Setting lelimit to 1, 2 or 3 causes a timeout

wget -O - -q "https://de.wikipedia.org/w/api.php?format=json&formatversion=2&action=query&list=logevents&leprop=timestamp&leuser=Triebt%C3%A4ter&lelimit=3" | jq .

Change 777864 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] api: Avoid unneeded page join in list=logevents

https://gerrit.wikimedia.org/r/777864

Change 777864 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] api: Avoid unneeded page join in list=logevents

https://gerrit.wikimedia.org/r/777864

(To clarify: this isn’t expected to fix the issue by changing how the query behaves at runtime, it just makes the query more readable to humans by dropping a JOIN when it’s not used, in cases where the database already ignores the JOIN.)

Change 777864 merged by jenkins-bot:

[mediawiki/core@master] api: Avoid unneeded page join in list=logevents

https://gerrit.wikimedia.org/r/777864