Page MenuHomePhabricator

Out of memory errors for ApiQueryImageInfo
Closed, DeclinedPublic

Description

I saw a significant number of POST requests to http://commons.wikimedia.org/w/api.php causing out of memory errors on fluorine:

Fatal error: Allowed memory size of 220200960 bytes exhausted (tried to allocate 8208 bytes) at /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiQueryImageInfo.php on line 443

#0 /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiQueryImageInfo.php(443): unserialize('a:35:{s:4:"Make...')
#1 /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiQueryImageInfo.php(158): ApiQueryImageInfo::getInfo(Object(LocalFile), Array, Object(ApiResult), NULL, Array)
#2 /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiQuery.php(278): ApiQueryImageInfo->execute()
#3 /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiMain.php(862): ApiQuery->execute()
#4 /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiMain.php(387): ApiMain->executeAction()
#5 /usr/local/apache/common-local/php-1.23wmf6/includes/api/ApiMain.php(358): ApiMain->executeActionWithErrorHandling()
#6 /usr/local/apache/common-local/php-1.23wmf6/api.php(76): ApiMain->execute()
#7 /usr/local/apache/common-local/w/api.php(3): require('/usr/local/apac...')
#8 {main}
[


Version: 1.23.0
Severity: normal

Details

Reference
bz58571

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:28 AM
bzimport set Reference to bz58571.
bzimport added a subscriber: Unknown Object (MLST).

This might be related to Bug 30751

I've narrowed it down to the inclusion of image metadata, apparently the many small objects involved there use quite a bit of memory. When I locally hack things to just shove in the serialized string (i.e. returning all the same data, just encoded differently) the memory usage is much less.

CCing Bawolff since he's been working with image metadata recently and might have more insights on what may have changed or how to fix it.

As a workaround, you could use a lower geilimit. Gerrit change 83935 (coming with 1.22wmf17, which is scheduled to hit Commons on Monday) will make this happen anyway for people who aren't bots or admins.

Closing for now, as this hasn't been record in Logstash for at least 30 days it seems (no fatal errors mentioning "ApiQueryImageInfo"). The related refactoring work that is proposed remains tracked at T89971.