Last modified: 2007-09-26 04:31:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T13404, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11404 - API returns internal error when unable to connect to DB due to heavy load
API returns internal error when unable to connect to DB due to heavy load
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-19 21:00 UTC by CBM
Modified: 2007-09-26 04:31 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description CBM 2007-09-19 21:00:41 UTC
When the DBs are under heavy load, it's possible to get the API to return 'internal_api_error' when a connection to the DB fails.  It would be nice if this error code was changed to something distinctive, because users will need to detect this condition and retry the request, and right now that seems to require parsing the 'info' parameter of the error code, not just the 'code' parameter.  

Here's a dump of the error message object I received. 

'error' => {
  'code' => 'internal_api_error',
  'info' => 'Exception Caught: DB connection error: All servers busy',
  'content' => '
#0 /usr/local/apache/common-local/php-1.5/includes/LoadBalancer.php(361): 
     LoadBalancer->reportConnectionError(Object(Database))
#1 [internal function]: 
     LoadBalancer->getConnection(-1, true, Array)
#2 /usr/local/apache/common-local/php-1.5/includes/StubObject.php(32): 
     call_user _func_array(Array, Array)
#3 /usr/local/apache/common-local/php-1.5/includes/StubObject.php(40): 
     StubObject->_call(\'getConnection\', Array)
#4 [internal function]: 
     StubObject->__call(\'getConnection\', Array)
#5 /usr/local/apache/common-local/php-1.5/includes/GlobalFunctions.php(2285): 
     StubObject->getConnection(-1, true, Array)
#6 /usr/local/apache/common-local/php-1.5/includes/api/ApiQuery.php(119): 
     wfGetDB(-1)
#7 /usr/local/apache/common-local/php-1.5/includes/api/ApiQueryBase.php(182): 
     ApiQuery->getDB()
#8 /usr/local/apache/common-local/php-1.5/includes/api/ApiQueryBacklinks.php(136):
     ApiQueryBase->getDB()
#9 /usr/local/apache/common-local/php-1.5/includes/api/ApiQueryBacklinks.php(93):
     ApiQueryBacklinks->run()
#10 /usr/local/apache/common-local/php-1.5/includes/api/ApiQuery.php(196): 
     ApiQueryBacklinks->execute()
#11 /usr/local/apache/common-local/php-1.5/includes/api/ApiMain.php(306): 
     ApiQuery->execute()
#12 /usr/local/apache/common-local/php-1.5/includes/api/ApiMain.php(192): 
     ApiMain->executeAction()
#13 /usr/local/apache/common-local/php-1.5/includes/api/ApiMain.php(177):   
     ApiMain->executeActionWithErrorHandling()
#14 /usr/local/apache/common-local/php-1.5/api.php(54): 
     ApiMain->execute()
#15 /usr/local/apache/common-local/live-1.5/api.php(3): 
     require(\'/usr/local/apac...\')
#16 {main}'
}
Comment 1 Daniel Cannon (AmiDaniel) 2007-09-26 04:31:28 UTC
Committed r26140. Name of the exception caught now included in the error code of the message. This should be distinct enough for client-side handling (i.e., your problem will produce an error code of 'internal_api_error_SQLException', whereas others may produce 'internal_api_error_MWException', etc.).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links