New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryEngine encounters a "Error: 5 Out of memory" #2130

Closed
mwjames opened this Issue Dec 31, 2016 · 2 comments

Comments

2 participants
@mwjames
Contributor

mwjames commented Dec 31, 2016

Issue

[0] observed a "Error: 5 Out of memory" [1, 2] which indicates a severe issue with the DB back-end configuration and causing a SQL request to fail for a simple query like:

SELECT DISTINCT t5.smw_id AS id,t5.smw_title AS t,t5.smw_namespace AS ns,t5.smw_iw AS iw,t5.smw_subobject AS so,t5.smw_sortkey AS sortkey
FROM `smw_object_ids` AS t5
INNER JOIN `smw_di_number` AS t1 ON t5.smw_id=t1.s_id
INNER JOIN `smw_di_number` AS t3 ON t1.s_id=t3.s_id
WHERE ((t1.o_sortkey<='79106') AND t1.p_id='181' AND ((t3.o_sortkey!='79106') AND t3.p_id='181'))
ORDER BY t1.o_sortkey DESC
LIMIT 6 
Exception encountered, of type "RuntimeException"
[3b8796f9] /index.php?title=79106_Cavalry_Builder_Set&action=submit RuntimeException from line 181 of /var/www/core/extensions/SemanticMediaWiki/src/MediaWiki/Database.php: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT DISTINCT t5.smw_id AS id,t5.smw_title AS t,t5.smw_namespace AS ns,t5.smw_iw AS iw,t5.smw_subobject AS so,t5.smw_sortkey AS sortkey FROM `smw_object_ids` AS t5 INNER JOIN `smw_di_number` AS t1 ON t5.smw_id=t1.s_id INNER JOIN `smw_di_number` AS t3 ON t1.s_id=t3.s_id WHERE ((t1.o_sortkey<='79106') AND t1.p_id='181' AND ((t3.o_sortkey!='79106') AND t3.p_id='181')) ORDER BY t1.o_sortkey DESC LIMIT 6 
Function: SMW\SQLStore\QueryEngine\QueryEngine::getInstanceQueryResult
Error: 5 Out of memory (Needed 2096432 bytes) (localhost)

#0 /var/www/core/includes/db/Database.php(1076): DatabaseBase->reportQueryError('Out of memory (...', 5, 'SELECT DISTINC...', 'SMW\\SQLStore\\Qu...', false)
#1 /var/www/core/includes/db/Database.php(1600): DatabaseBase->query('SELECT DISTINC...', 'SMW\\SQLStore\\Qu...')
#2 /var/www/core/extensions/SemanticMediaWiki/src/MediaWiki/Database.php(179): DatabaseBase->select('`smw_object_ids...', 'DISTINCT t5.smw...', '((t1.o_sortkey<...', 'SMW\\SQLStore\\Qu...', Array, Array)
#3 /var/www/core/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QueryEngine.php(420): SMW\MediaWiki\Database->select('`smw_object_ids...', 'DISTINCT t5.smw...', '((t1.o_sortkey<...', 'SMW\\SQLStore\\Qu...', Array)
#4 /var/www/core/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QueryEngine.php(226): SMW\SQLStore\QueryEngine\QueryEngine->getInstanceQueryResult(Object(SMWQuery), 5)
#5 /var/www/core/extensions/SemanticMediaWiki/includes/storage/SQLStore/SMW_SQLStore3.php(380): SMW\SQLStore\QueryEngine\QueryEngine->getQueryResult(Object(SMWQuery))
#6 /var/www/core/extensions/SemanticMediaWiki/includes/storage/SQLStore/SMW_SQLStore3.php(371): SMWSQLStore3->fetchQueryResult(Object(SMWQuery))
#7 /var/www/core/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(510): SMWSQLStore3->getQueryResult(Object(SMWQuery))
#8 /var/www/core/extensions/SemanticMediaWiki/includes/parserhooks/AskParserFunction.php(163): SMWQueryProcessor::getResultFromQuery(Object(SMWQuery), Array, 2, 1)
#9 /var/www/core/extensions/SemanticMediaWiki/includes/parserhooks/AskParserFunction.php(120): SMW\AskParserFunction->doFetchResultsForRawParameters(Array)
#10 /var/www/core/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(248): SMW\AskParserFunction->parse(Array)

Solution

This issue cannot be solved by SMW where the DB back-end itself is refusing (or better is incapable to answer) the request due to technical limitations.

It is suggested to consult the MySQL documentation [1, 2] to see whether increasing the "buffer_size" can help mitigate the encountered issue or not.

[0] https://phabricator.wikimedia.org/T152737
[1] http://forums.mysql.com/read.php?20,429609,429609
[2] http://stackoverflow.com/questions/22203192/out-of-memory-error-from-mysql

@mwjames

This comment has been minimized.

Show comment
Hide comment
@mwjames

mwjames Dec 31, 2016

Contributor

@kghbln I only created this issue to document the technical circumstances.

Contributor

mwjames commented Dec 31, 2016

@kghbln I only created this issue to document the technical circumstances.

@kghbln

This comment has been minimized.

Show comment
Hide comment
@kghbln

kghbln Jan 7, 2017

Member

@mwjames I remembered that we have a general page on "Troubleshooting" on wiki, too. Thus I added a reference to allow another entry point.

Member

kghbln commented Jan 7, 2017

@mwjames I remembered that we have a general page on "Troubleshooting" on wiki, too. Thus I added a reference to allow another entry point.

@kghbln kghbln added this to Troubleshooting in Documentation Apr 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment