Page MenuHomePhabricator

DBConnectionError on MSSQL: Cannot access the database: Unknown error
Closed, DeclinedPublic

Description

MW Version: 1.32.1
DB: MSSQL

This error occurs on occasion without any apparent cause. I have seen similar errors reported, but none exactly like this. When it does occur, we usually see about 10 or 12 instances of it in a row.

Could this be an MSSQL issue?

Wikimedia\Rdbms\DBConnectionError: Cannot access the database: Unknown error ([redacted]) in includes\libs\rdbms\loadbalancer\LoadBalancer.php:1199
Stack trace:
#0 includes\libs\rdbms\loadbalancer\LoadBalancer.php(769): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 includes\GlobalFunctions.php(2694): Wikimedia\Rdbms\LoadBalancer->getConnection(0, Array, false)
#2 includes\user\User.php(535): wfGetDB(-1)
#3 includes\libs\objectcache\WANObjectCache.php(1128): User->{closure}(false, 3600, Array, NULL)
#4 includes\libs\objectcache\WANObjectCache.php(1277): WANObjectCache->{closure}(false, 3600, Array, NULL)
#5 includes\libs\objectcache\WANObjectCache.php(1133): WANObjectCache->doGetWithSetCallback('global:user:id:...', 3600, Object(Closure), Array, NULL)
#6 includes\user\User.php(562): WANObjectCache->getWithSetCallback('global:user:id:...', 3600, Object(Closure), Array)
#7 includes\user\User.php(480): User->loadFromCache()
#8 includes\user\User.php(417): User->loadFromId(0)
#9 includes\session\UserInfo.php(88): User->load()
#10 includes\session\CookieSessionProvider.php(119): MediaWiki\Session\UserInfo::newFromId('1')
#11 includes\session\SessionManager.php(488): MediaWiki\Session\CookieSessionProvider->provideSessionInfo(Object(WebRequest))
#12 includes\session\SessionManager.php(191): MediaWiki\Session\SessionManager->getSessionInfoForRequest(Object(WebRequest))
#13 includes\WebRequest.php(750): MediaWiki\Session\SessionManager->getSessionForRequest(Object(WebRequest))
#14 includes\session\SessionManager.php(130): WebRequest->getSession()
#15 includes\Setup.php(851): MediaWiki\Session\SessionManager::getGlobalSession()
#16 includes\WebStart.php(77): require_once('[redacted]\\...')
#17 index.php(39): require('[redacted]\\...')
#18 {main}

Thanks,
Eric

Event Timeline

Without more information, I cannot tell you whether this is a problem with MediaWiki configuration, or the Wikimedia-rdbms PHP library, or with your database server.

In general, when it comes to connecting to the database, if this fails, it is in my experience usually a problem with the database server. Perhaps you can check its logs, or try to connect to it from another application?

Also, see https://www.mediawiki.org/wiki/Manual:How_to_debug for how to get additional log details from MediaWiki, which might help reveal the root cause.

Krinkle renamed this task from Wikimedia\Rdbms\DBConnectionError: Cannot access the database: Unknown error to DBConnectionError on MSSQL: Cannot access the database: Unknown error.Jul 24 2019, 2:38 PM

Heads-up: As per RFC discussion in August 2019, the previously experimental support for using Oracle or MSSQL as database backends in MediaWiki core has been removed in MediaWiki 1.34, so this task might end up as declined in the future.

For what its worth; i commented out these lines in LocalSsettings.php and everything worked. Morning wasted.

# Schemas for Postgres
$wgDBmwschema       = "mediawiki";
$wgDBts2schema      = "public";

# Experimental charset support for MySQL 4.1/5.0.
$wgDBmysql5 = false;