Bug #80875
openMultiple problems with relation handler if too many records exist on a page
100%
Description
I've multiple problems with the relation handler if i modify (edit, delete) a record that is stored on a page where many records of that type exist.
Steps to reproduce:
- Install tt_address (should also work with any other record that uses categories)
- Create a sys_category record
- Create a Page of type folder
- Store 70.000 Records of type tt_address in that folder and put all records into the same sys_category
Steps that fail:
- Open one of the records and try to save the record
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 294912 bytes) in /xxx/vendor/typo3/cms/typo3/sysext/core/Classes/Database/ReferenceIndex.php on line 226
- Try to delet a record
Core: Exception handler (WEB): Uncaught TYPO3 Exception: An exception occurred while executing 'SELECT `uid`, `t3ver_oid`, `t3ver_state` FROM `tt_address` WHERE (`pid` = ?) AND (`t3ver_oid` IN (?, ?, ?, ?, ### HERE ARE AROUND 70.000 PLACEHOLDERS!### , ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) AND (`t3ver_wsid` <> ?) ORDER BY `t3ver_state` DESC' with params [-1, 6877, ... ###HERE ARE AROUND 70.000 IDS!###, 0]: Prepared statement contains too many placeholders | Doctrine\DBAL\Exception\DriverException thrown in file /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php in line 115. Requested URL: https://xxx/typo3/index.php?route=%2Frecord%2Fcommit&token=b7ea833b34189d38b4fd1100f4a55766c16b0613&redirect=%2Ftypo3%2Findex.php%3FM%3Dweb_list%26moduleToken%3D114051d1fe77316e97e2afd42f8034d93a647a7d%26id%3D1316%26table%3D%26imagemode%3D1%26search_field%3Da%26table%3Dtt_address&cmd[tt_address][1300][delete]=1&prErr=1
There a multiple probelms but all of them are related to the realtion handling.
The relation handler does fetch all ids and puts them into a prepared statement. That fails as prepared statements to only allow 65.536 placeholders.
So this should be solved by a subquery and not by fetching all ids.
The other problem is, that all records are fetched and this ends up in a excessive memory usage.
It looks like all actions are executed as expected (records are deleted and saved) but the state of the databse is or can be inconsistent as the save process fails somewhere in the middle.
Updated by Thomas Hohn over 7 years ago
We actually ended up using https://github.com/NamelessCoder/asynchronous_reference_indexing instead since we faced issues like this too.
Updated by Benni Mack over 7 years ago
- Target version changed from 8 LTS to next-patchlevel
Updated by Sascha Egerer over 7 years ago
Thomas Hohn wrote:
We actually ended up using https://github.com/NamelessCoder/asynchronous_reference_indexing instead since we faced issues like this too.
This extension is not production ready. Looks like file references are not updated correctly.
The error does also occur if i try to update the reference index via the CLI tasks or in the backend db tools.
Updated by Oliver Hader over 7 years ago
Thx for the report! Sascha, could you please give a stack-track for both steps mentioned above? Thx in advance!
Updated by Sascha Egerer over 7 years ago
- Status changed from New to Accepted
- Assignee set to Sascha Egerer
I'll take care and post an update
Updated by Sascha Egerer over 7 years ago
- Related to Bug #80800: Too many records on sys_file_reference table breaks TYPO3 when saving IRRE records added
Updated by Anu Bhuvanendran Nair over 7 years ago
- Related to Bug #81993: 'Uncaught TYPO3 Exception' pops up when news records are localized added
Updated by Ricky Mathew about 7 years ago
- Related to Bug #82233: File Abstraction Layer: Update storage index (scheduler) failure due to query constraints. added
Updated by Thomas Rawiel over 6 years ago
Sascha, here is the requested stack trace,
when running
./typo3cms cleanup:orphanrecords -vvvvia CLI
(TYPO3 8.7.16)
[ Doctrine\DBAL\Exception\DriverException ] An exception occurred while executing 'SELECT `uid` FROM `tx_dmdeveloperlog_domain_model_logentry` WHERE `uid` NOT IN (?, ###ABOUT 140000 Placeholders###, ?) ORDER BY `uid` ASC' with params [###LIST-OF-IDs###]: Prepared statement contains too many placeholders Exception trace: #0 () /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115 #1 Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException() /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:128 #2 Doctrine\DBAL\DBALException::driverExceptionDuringQuery() /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855 #3 Doctrine\DBAL\Connection->executeQuery() /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:206 #4 Doctrine\DBAL\Query\QueryBuilder->execute() typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:187 #5 TYPO3\CMS\Core\Database\Query\QueryBuilder->execute() typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php:109 #6 TYPO3\CMS\Lowlevel\Command\OrphanRecordsCommand->execute() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Command/Command.php:252 #7 Symfony\Component\Console\Command\Command->run() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Application.php:946 #8 Symfony\Component\Console\Application->doRunCommand() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Application.php:248 #9 Symfony\Component\Console\Application->doRun() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Application.php:148 #10 Symfony\Component\Console\Application->run() typo3conf/ext/typo3_console/Classes/Console/Core/Kernel.php:162 #11 Helhum\Typo3Console\Core\Kernel->handle() typo3conf/ext/typo3_console/Scripts/typo3-console.php:19 #12 {closure}() typo3conf/ext/typo3_console/Scripts/typo3-console.php:21 #13 require() typo3cms:18 Caused by: [ Doctrine\DBAL\Driver\Mysqli\MysqliException ] Prepared statement contains too many placeholders Exception trace: #0 () /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:94 #1 Doctrine\DBAL\Driver\Mysqli\MysqliStatement->__construct() /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php:120 #2 Doctrine\DBAL\Driver\Mysqli\MysqliConnection->prepare() /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:844 #3 Doctrine\DBAL\Connection->executeQuery() /var/www/src/typo3_src-8.7.16/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:206 #4 Doctrine\DBAL\Query\QueryBuilder->execute() typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:187 #5 TYPO3\CMS\Core\Database\Query\QueryBuilder->execute() typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php:109 #6 TYPO3\CMS\Lowlevel\Command\OrphanRecordsCommand->execute() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Command/Command.php:252 #7 Symfony\Component\Console\Command\Command->run() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Application.php:946 #8 Symfony\Component\Console\Application->doRunCommand() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Application.php:248 #9 Symfony\Component\Console\Application->doRun() typo3conf/ext/typo3_console/Libraries/symfony-process.phar/vendor/symfony/console/Application.php:148 #10 Symfony\Component\Console\Application->run() typo3conf/ext/typo3_console/Classes/Console/Core/Kernel.php:162 #11 Helhum\Typo3Console\Core\Kernel->handle() typo3conf/ext/typo3_console/Scripts/typo3-console.php:19 #12 {closure}() typo3conf/ext/typo3_console/Scripts/typo3-console.php:21 #13 require() typo3cms:18 cleanup:orphanrecords [--dry-run]
Updated by Sascha Egerer over 6 years ago
Thomas Rawiel wrote:
Sascha, here is the requested stack trace,
when running
[...] via CLI
(TYPO3 8.7.16)[...]
Will be handled in #85257
Updated by Gleb Levitin over 6 years ago
- Related to Bug #85795: Too many records on reference index updating break TYPO3 added
Updated by Gleb Levitin over 6 years ago
- Related to deleted (Bug #85795: Too many records on reference index updating break TYPO3)
Updated by Gleb Levitin over 6 years ago
- Related to Bug #85795: Too many records on reference index updating break TYPO3 added
Updated by Gleb Levitin over 6 years ago
- Related to deleted (Bug #85795: Too many records on reference index updating break TYPO3)
Updated by DMK E-BUSINESS GmbH almost 6 years ago
It would be great to see some progress. It's not a good sign that an enterprise CMS is not able to edit a category with several thousand referenced elements in the backend.
Updated by Benni Mack over 5 years ago
- Target version changed from next-patchlevel to Candidate for patchlevel
Updated by Alexander Schnitzler about 4 years ago
- Related to Bug #86859: Search with indexed_search plugin throws exception: Prepared statement contains too many placeholders added