Bug #89831
closed
System information toolbar slows down or breaks BE login because it queries all configured database connections which may be slow/gone
Added by Stefan P over 4 years ago.
Updated about 4 years ago.
Category:
Backend User Interface
Sprint Focus:
Needs Decision
Description
Steps to reproduce:
- Have a TYPO3 setup
- configure multiple Database conenctions where at least one is slow or currently gone
- log into the Backend
- login takes forever because the slow or even fails with error because the unavailable (-> fail with timeout) DB is queried as well
Expected result: Only databases that are actually used are queried.
It's totally valid to have slow or unavailable Databases configured in the Connection Pool. For example when using them for scheduled interface commands to import data from foreign data sources.
TYPO3 should not query all configured Databases if there's no current need. It's OK to list the configured ones, but actual connections should not be opened without demand.
The causing code is the class SystemInformationToolbarItem
- the getDatabase()
method.
Even when having fast connections: having many of fast connections can still slow down the login.
Files
- Status changed from New to Needs Feedback
thanks for creating this issue. The method getDatabase
lists all used databases including their version.
the only option I see is to just show the default connection and remove the listing of all others. do you see any other option?
code would look like this then
protected function getDatabase()
{
$this->systemInformation[] = [
'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:toolbarItems.sysinfo.database',
'titleAddition' => ConnectionPool::DEFAULT_CONNECTION_NAME,
'value' => GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME)
->ping(),
'iconIdentifier' => 'information-database'
];
}
This is a possibility.
Another way: Only list Default and all connection that explicitly have tables mapped to them (we get them by connection name not by table name, because no tables are mapped to the TYPO3 system itself, because they are only needed in foreign data retrieval in commands)
Yet another way: add a flag that allows to mark connections as "external", like 'external' => true
and let the Toolbar only show "Default" and "non-external" and skip all "external" ones.
Or a combination of both ways. List all that are: Default OR (have tables mapped AND NOT external)
I agree that an error on a non-essential connection should not result in an exception or a hard error, however I think it's useful to display the status of all globally configured connections.
For your use case of configuring database connections that are only used at certain points of the code (and should therefor also not be used by the next developer who might think that he needs to) I would suggest to fully configure the database either conditionally in additionalConfiguration or runtime. While it's a valid use case I do consider it bad form to provide that connection globally if it is not generally available.
I'm going to push a patch to address the first part of this issue.
- Status changed from Needs Feedback to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
A step in the right direction, but this won't solve the problem about slow loading times. The Backend will still wait for the timeout to happen on unavailable connections before continuing.
- Sprint Focus changed from PRC to Needs Decision
- Status changed from Resolved to Closed
Also available in: Atom
PDF