Skip to content
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

Unhandled exception on failed DB connect - exception should be handled. #26744

Closed
TDannhauer opened this issue Nov 30, 2016 · 8 comments
Closed

Comments

@TDannhauer
Copy link
Contributor

TDannhauer commented Nov 30, 2016

Hi,

while migration an OC instance to another machine, I did everything correct (as it turns out) except adapting the PostgreSQL databad credetials for the new database. Yes I know, very stupid and unneccessary mistake.. shame
However, it took me a while to discover it since calling my new OC webinterface ended without any comment in Logfiles with the WSOD.

At the end, I discovered the error using occ, that the database connection failed but was not handled. PLease find the callstack below

I suggest to add a failed postgres connect as a handled exception - I think I'm not the only one doing such stupid mistakes.

:)

Thanks!
Torben

Callstack:

 ./occ
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[08006] [7] FATAL:  Passwort-Authentifizierung für Benutzer »owncloud« fehlgeschlagen
FATAL:  Passwort-Authentifizierung für Benutzer »owncloud« fehlgeschlagen in /var/www/owncloud/lib/private/DB/Connection.php:58
Stack trace:
#0 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/owncloud/lib/private/DB/Connection.php(141): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOPgSql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /var/www/owncloud/lib/private/DB/ConnectionFactory.php(120): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/owncloud/lib/private/Server.php(410): OC\DB\ConnectionFactory->getConnection('pgsql', Array)
#8 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#9 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('DatabaseConnect...')
#10 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#11 /var/www/owncloud/lib/private/Server.php(969): OC\ServerContainer->query('DatabaseConnect...')
#12 /var/www/owncloud/lib/private/Server.php(215): OC\Server->getDatabaseConnection()
#13 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#14 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\\Authenticati...')
#15 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#16 /var/www/owncloud/lib/private/Server.php(219): OC\ServerContainer->query('OC\\Authenticati...')
#17 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#18 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\\Authenticati...')
#19 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#20 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(150): OC\ServerContainer->query('OC\\Authenticati...')
#21 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#22 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\\Authenticati...')
#23 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...')
#24 /var/www/owncloud/lib/private/Server.php(234): OC\ServerContainer->query('OC\\Authenticati...')
#25 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#26 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('UserSession')
#27 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#28 /var/www/owncloud/lib/private/Server.php(853): OC\ServerContainer->query('UserSession')
#29 /var/www/owncloud/lib/private/Server.php(651): OC\Server->getSession()
#30 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#31 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('CsrfTokenManage...')
#32 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('CsrfTokenManage...')
#33 /var/www/owncloud/lib/private/Server.php(1309): OC\ServerContainer->query('CsrfTokenManage...')
#34 /var/www/owncloud/lib/private/Server.php(556): OC\Server->getCsrfTokenManager()
#35 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#36 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('Request')
#37 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('Request')
#38 /var/www/owncloud/lib/private/Server.php(720): OC\ServerContainer->query('Request')
#39 /var/www/owncloud/lib/private/Server.php(301): OC\Server->getRequest()
#40 /var/www/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#41 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('L10NFactory')
#42 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('L10NFactory')
#43 /var/www/owncloud/lib/private/Server.php(905): OC\ServerContainer->query('L10NFactory')
#44 /var/www/owncloud/lib/private/Server.php(916): OC\Server->getL10NFactory()
#45 /var/www/owncloud/lib/base.php(228): OC\Server->getL10N('lib')
#46 /var/www/owncloud/lib/base.php(578): OC::checkConfig()
#47 /var/www/owncloud/lib/base.php(973): OC::init()
#48 /var/www/owncloud/console.php(58): require_once('/var/www/owncloud...')
#49 /var/www/owncloud/occ(11): require_once('/var/www/owncloud...')
@PVince81
Copy link
Contributor

on master the WSOD should now be replaced with a string containing the actual error message. Maybe we should backport that fix

@TDannhauer
Copy link
Contributor Author

Great, that was a fast fix! :)

@PVince81
Copy link
Contributor

Hmm, now looking at it I'm not 100% sure if it would fix this use case: #26075

@TDannhauer
Copy link
Contributor Author

Hm, honestly I don't understand the purpose of #26075..

@PVince81
Copy link
Contributor

The purpose is simple: in some code path an error happens so early that the whole templating/logging system could not be initialized. Without these two it is impossible to use them to either render a nice error page or log an error in the log file. So without the fix it would just throw the exception and not print it anywhere: white page. With the fix at least the exception is caught and printed as a plain text within that white page.

Hope that explains it.

Since you mentioned a white page I suspect that the DB error also occurs quite early so the template system isn't loaded yet when the exception comes, so I think the PR would also catch it.

Needs testing.

@PVince81
Copy link
Contributor

PVince81 commented Dec 5, 2016

I have tested this on stable9.1 and master with a failing Mysql connection (I shut down the server).

I can confirm that instead of a white page the exception now appears directly on that page.

@PVince81 PVince81 closed this as completed Dec 5, 2016
@PVince81
Copy link
Contributor

PVince81 commented Dec 5, 2016

that is, fixed on master

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants