Project

General

Profile

Actions

Bug #80875

open

Multiple problems with relation handler if too many records exist on a page

Added by Sascha Egerer over 7 years ago. Updated over 5 years ago.

Status:
Accepted
Priority:
Should have
Assignee:
Category:
DataHandler aka TCEmain
Start date:
2017-06-12
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

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:

  1. Install tt_address (should also work with any other record that uses categories)
  2. Create a sys_category record
  3. Create a Page of type folder
  4. Store 70.000 Records of type tt_address in that folder and put all records into the same sys_category

Steps that fail:

  1. 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
    
  1. 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.


Subtasks 4 (0 open4 closed)

Bug #81555: Do not use prepared statements for reference index queriesClosedSascha Egerer2017-06-12

Actions
Bug #85257: OrphanRecordsCommand fails if list of ids is too longClosed2018-06-13

Actions
Bug #85795: Too many records on reference index updating break TYPO3Closed2018-08-09

Actions
Bug #85797: Too many record uids in plain data resolver break TYPO3Closed2018-08-09

Actions

Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #80800: Too many records on sys_file_reference table breaks TYPO3 when saving IRRE recordsClosed2017-04-10

Actions
Related to TYPO3 Core - Bug #81993: 'Uncaught TYPO3 Exception' pops up when news records are localizedClosed2017-07-28

Actions
Related to TYPO3 Core - Bug #82233: File Abstraction Layer: Update storage index (scheduler) failure due to query constraints.Closed2017-08-29

Actions
Related to TYPO3 Core - Bug #86859: Search with indexed_search plugin throws exception: Prepared statement contains too many placeholders Closed2018-11-05

Actions
Actions

Also available in: Atom PDF