#80875Multiple problems with relation handler if too many records exist on a page
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.
Reviews 2
- TYPO3_8-7 57230[BUGFIX] Do not use named parameter for list of orphan records ids
- main 57213[BUGFIX] Do not use named parameter for list of orphan records ids
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch
- Commit message
-
[BUGFIX] Multiple problems with relation handler if too many records exist on a page Resolves: #80875 Releases: main
Subtasks 4
Related issues 4
- Bug #80800Too many records on sys_file_reference table breaks TYPO3 when saving IRRE records
- Bug #81993'Uncaught TYPO3 Exception' pops up when news records are localized
- Bug #82233File Abstraction Layer: Update storage index (scheduler) failure due to query constraints.
- Bug #86859Search with indexed_search plugin throws exception: Prepared statement contains too many placeholders