Page MenuHomePhabricator

Expectation (readQueryTime <= 5) by MediaWiki\Api\ApiMain::setRequestExpectations not met (actual: {actualSeconds}) in trx #{trxId}:{query}
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
  • mwversion: 1.47.0-wmf.5
  • timestamp: 2026-06-04T14:46:03.069Z
  • phpversion: 8.3.31
  • reqId: 4838ef55-faed-42c9-8cbf-7c59a0e65fd2
  • Find reqId in Logstash
normalized_message
Expectation (readQueryTime <= 5) by MediaWiki\Api\ApiMain::setRequestExpectations not met (actual: {actualSeconds}) in trx #{trxId}:
{query}
FrameLocationCall
from/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/TransactionProfiler.php(569)
#0/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/TransactionProfiler.php(375)Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated(string, Wikimedia\Rdbms\GeneralizedSql, float, string, string)
#1/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/TransactionManager.php(571)Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, float, bool, int, string, string)
#2/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/Database.php(850)Wikimedia\Rdbms\TransactionManager->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, float, bool, int, string)
#3/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/Database.php(708)Wikimedia\Rdbms\Database->attemptQuery(Wikimedia\Rdbms\Query, string, bool)
#4/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/Database.php(635)Wikimedia\Rdbms\Database->executeQuery(Wikimedia\Rdbms\Query, string, int)
#5/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/Database.php(1368)Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#6/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/DBConnRef.php(129)Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#7/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/Database/DBConnRef.php(386)Wikimedia\Rdbms\DBConnRef->__call(string, array)
#8/srv/mediawiki/php-1.47.0-wmf.5/includes/libs/Rdbms/QueryBuilder/SelectQueryBuilder.php(761)Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#9/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiQueryBase.php(451)Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet()
#10/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiQueryAllImages.php(276)MediaWiki\Api\ApiQueryBase->select(string)
#11/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiQueryAllImages.php(63)MediaWiki\Api\ApiQueryAllImages->run()
#12/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiQuery.php(735)MediaWiki\Api\ApiQueryAllImages->execute()
#13/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiMain.php(2046)MediaWiki\Api\ApiQuery->execute()
#14/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiMain.php(944)MediaWiki\Api\ApiMain->executeAction()
#15/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiMain.php(915)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#16/srv/mediawiki/php-1.47.0-wmf.5/includes/Api/ApiEntryPoint.php(138)MediaWiki\Api\ApiMain->execute()
#17/srv/mediawiki/php-1.47.0-wmf.5/includes/MediaWikiEntryPoint.php(180)MediaWiki\Api\ApiEntryPoint->execute()
#18/srv/mediawiki/php-1.47.0-wmf.5/api.php(30)MediaWiki\MediaWikiEntryPoint->run()
#19/srv/mediawiki/w/api.php(3)require(string)
#20{main}
Impact
Notes

Details

Request URL
https://commons.wikimedia.org/w/api.php?action=query&aicontinue=*&aidir=*&ailimit=*&aiprop=*&aisort=*&continue=*&format=*&list=*
Related Changes in Gerrit:

Event Timeline

ikiadmin2023@10.64.16.77(commonswiki)> explain SELECT  *  FROM (SELECT  file_id AS `img_file_id`,fr_id AS `img_filerevision_id`,file_name AS `img_name`,fr_size AS `img_size`,fr_width AS `img_width`,fr_height AS `img_height`,fr_metadata AS `img_metadata`,fr_bits AS `img_bits`,ft_media_type AS `img_media_type`,ft_major_mime AS `img_major_mime`,ft_minor_mime AS `img_minor_mime`,fr_timestamp AS `img_timestamp`,fr_sha1 AS `img_sha1`,fr_actor AS `img_actor`,image_actor.actor_user AS `img_user`,image_actor.actor_name AS `img_user_text`,comment_img_description.comment_text AS `img_description_text`,comment_img_description.comment_data AS `img_description_data`,comment_img_description.comment_id AS `img_description_cid`  FROM `file` JOIN `filerevision` ON ((file_latest = fr_id)) JOIN `filetypes` ON ((file_type = ft_id)) JOIN `actor` `image_actor` ON ((actor_id=fr_actor)) JOIN `comment` `comment_img_description` ON ((comment_img_description.comment_id = fr_description_id))   WHERE file_deleted = 0  ) `sqb1`    WHERE (img_timestamp < '20260317181512' OR (img_timestamp = '20260317181512' AND (img_name <= 'IN_Winamac_160372_1962_24000_geo_(TIF).tif')))  ORDER BY img_timestamp DESC,img_name DESC LIMIT 501  ;
+------+-------------+-------------------------+--------+-----------------------------------------+---------+---------+--------------------------------------------+-----------+----------------------------------------------+
| id   | select_type | table                   | type   | possible_keys                           | key     | key_len | ref                                        | rows      | Extra                                        |
+------+-------------+-------------------------+--------+-----------------------------------------+---------+---------+--------------------------------------------+-----------+----------------------------------------------+
|    1 | SIMPLE      | file                    | ALL    | file_name,file_latest                   | NULL    | NULL    | NULL                                       | 121806109 | Using where; Using temporary; Using filesort |
|    1 | SIMPLE      | filerevision            | eq_ref | PRIMARY,fr_actor_timestamp,fr_timestamp | PRIMARY | 8       | commonswiki.file.file_latest               | 1         | Using where                                  |
|    1 | SIMPLE      | filetypes               | eq_ref | PRIMARY                                 | PRIMARY | 2       | commonswiki.file.file_type                 | 1         |                                              |
|    1 | SIMPLE      | image_actor             | eq_ref | PRIMARY                                 | PRIMARY | 8       | commonswiki.filerevision.fr_actor          | 1         |                                              |
|    1 | SIMPLE      | comment_img_description | eq_ref | PRIMARY                                 | PRIMARY | 8       | commonswiki.filerevision.fr_description_id | 1         |                                              |
+------+-------------+-------------------------+--------+-----------------------------------------+---------+---------+--------------------------------------------+-----------+----------------------------------------------+
5 rows in set (0.003 sec)

wikiadmin2023@10.64.16.77(commonswiki)>

This is how the query in the read old looks like.

wikiadmin2023@10.64.32.58(commonswiki)> explain SELECT  img_name,img_size,img_width,img_height,img_metadata,img_bits,img_media_type,img_major_mime,img_minor_mime,img_timestamp,img_sha1,img_actor,image_actor.actor_user AS `img_user`,image_actor.actor_name AS `img_user_text`,comment_img_description.comment_text AS `img_description_text`,comment_img_description.comment_data AS `img_description_data`,comment_img_description.comment_id AS `img_description_cid`  FROM `image` JOIN `actor` `image_actor` ON ((actor_id=img_actor)) JOIN `comment` `comment_img_description` ON ((comment_img_description.comment_id = img_description_id))   WHERE (img_timestamp < '20260317181512' OR (img_timestamp = '20260317181512' AND (img_name <= 'IN_Winamac_160372_1962_24000_geo_(TIF).tif')))  ORDER BY img_timestamp DESC,img_name DESC LIMIT 5001  ;
+------+-------------+-------------------------+--------+-------------------------------------------+---------------+---------+--------------------------------------+----------+-------------+
| id   | select_type | table                   | type   | possible_keys                             | key           | key_len | ref                                  | rows     | Extra       |
+------+-------------+-------------------------+--------+-------------------------------------------+---------------+---------+--------------------------------------+----------+-------------+
|    1 | SIMPLE      | image                   | range  | PRIMARY,img_timestamp,img_actor_timestamp | img_timestamp | 271     | NULL                                 | 64542568 | Using where |
|    1 | SIMPLE      | image_actor             | eq_ref | PRIMARY                                   | PRIMARY       | 8       | commonswiki.image.img_actor          | 1        |             |
|    1 | SIMPLE      | comment_img_description | eq_ref | PRIMARY                                   | PRIMARY       | 8       | commonswiki.image.img_description_id | 1        |             |
+------+-------------+-------------------------+--------+-------------------------------------------+---------------+---------+--------------------------------------+----------+-------------+
3 rows in set (0.004 sec)

wikiadmin2023@10.64.32.58(commonswiki)>

Change #1300932 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] api: Use fr_id as secondary sort in ApiQueryAllImages with new file tables

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

Change #1300932 merged by jenkins-bot:

[mediawiki/core@master] ApiQueryAllImages: Use fr_id as secondary sort with new file tables

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