Bug #57393

Task #57578: TceformsUpdateWizard improvements (Migrate all file relations from tt_content.image and pages.media)

Endless Loop in TceformsUpdateWizard

Added by Benjamin Pucher over 8 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Install Tool
Target version:
Start date:
2014-03-27
Due date:
% Done:

100%

Estimated time:
0.25 h
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

I'm currently updating a large TYPO3 Website from 4.5 to 6.2 and have found a bug in the Upgrade Wizard.
The migration with title 'Migrate all file relations from tt_content.image and pages.media' (typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php) ends up in an endless loop.
The problem exists in the do/while loop starting at line 188 respectively in the getRecordsFromTable method in typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php.

188 do {
189     $records = $this->getRecordsFromTable($table, $fieldToMigrate, $fieldsToGet, self::RECORDS_PER_QUERY);
190     foreach ($records as $record) {
191         $this->migrateField($table, $record, $fieldToMigrate, $fieldConfiguration, $customMessages);
192     }
193 } while (count($records) === self::RECORDS_PER_QUERY);

self::RECORDS_PER_QUERY is set to 1000. Every time a query like 'select ... LIMIT 1000' is created. Because there's no starting point defined after the LIMIT statement (which should be 0 on first loop and then += self::RECORDS_PER_QUERY) the query will always fetch the first self::RECORDS_PER_QUERY entries. Thus the while condition is always true.
To fix this the LIMIT statement should have the starting point included like LIMIT <entries_fetched_so_far>, self::RECORDS_PER_QUERY.

Please fix this asap since many people will update their TYPO3 LTS Websites shortly.


Related issues

Related to TYPO3 Core - Bug #43725: TceformsUpdateWizard exceeds memory_limit/max_execution_timeClosed2012-12-07

Actions
Related to TYPO3 Core - Task #57572: TceformsUpdateWizard has to handle SQL errorsClosedMarkus Klein2014-04-02

Actions
#1

Updated by Steffen Krüchten over 8 years ago

I can confirm this Bug, also trying to update a small Installation to 6.2.0 from 4.5.32 with PHP 5.3.27. Everything else went smooth, Frontend is up and running but no Content images at all.

Upgrade Wizard throws a "Uncaught TYPO3 Exception" in Debug-Mode when trying to execute "Migrate all file relations from tt_content.image and pages.media":
PHP Warning: Invalid argument supplied for foreach() in typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php line 190.

#2

Updated by Markus Klein over 8 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (next-patchlevel)

These are two different issues.

The issue reported here is IMO not an issue. The limit is ok, you can always start from 0, because the select query only looks at records not yet migrated!

Regarding the foreach() thing. There seems to be a DB issue, the select seems to fail.
I'll create a new ticket for this, which introduces a better check and issues an exception with the SQL error.

#3

Updated by Markus Klein over 8 years ago

The new ticket for the foreach() issue is #57572

#4

Updated by Markus Klein over 8 years ago

  • Parent task set to #57578
#5

Updated by Tobias Braumann about 8 years ago

I can confirm this Bug, too. In our case the Problem was that we have a lot of pictures in tt_content,
which no longer exist and the script don't set the image field to 1 or delete the entries.
So in the foreach() there are still the same 1000 entries (infinityloop).

We fix that problem by increasing the value self::RECORDS_PER_QUERY to the number of entries from tt_content.

#6

Updated by Alexander Opitz almost 8 years ago

  • Status changed from Needs Feedback to New
#7

Updated by Sebastian Helzle over 7 years ago

We also had this issue today with a big site (~15000 pages) and more than 1000 missing media files in the page properties because we tried the upgrade on a lightweight copy without the assets.

#8

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032

#9

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032

#10

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032

#11

Updated by Markus Klein over 7 years ago

We kindly ask you to please test the patch linked above with your databases.
If it works for you, please vote accordingly.

Thanks a lot!

#12

Updated by Markus Klein over 7 years ago

  • Target version set to next-patchlevel
  • Complexity changed from easy to medium
#13

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032

#14

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032

#15

Updated by shanmugarajan k over 7 years ago

It seems,once click Execute, i never see this "Migrate all file relations from tt_content.image and pages.media" upgrade wizard.

I have around 10000+ records.

I re-imported the db, but still i could not see the wizard again. can you please let me know if i doing something wrong?

#16

Updated by shanmugarajan k over 7 years ago

i just saw in the LocalConfiguration.php

'INSTALL' => array() having the 'wizardDone' wizard is entered. Hence its not visible again.

so it seems, this is added as soon as first run completed.

#17

Updated by Markus Klein over 7 years ago

@shanmugarajan

Which TYPO3 version are you upgrading from?
Are you sure you actually need this patch?

It can well be that the wizard manages to complete the migration in one go, so it won't show up again.

#18

Updated by shanmugarajan k over 7 years ago

Hello Markus,

Yes. i upgrading from 4.5 to 6.2.

Yes. needed. thanks.

#19

Updated by Nicole Cordes over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#20

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF