Update from Mautic 4.4.11 to 5.0.4 fails - memory exhausted

When updating in console from 4.4.11 to mautic 5.0.4 the apply --finish command fails with the memory exhausted.

Db: 10.5.17-MariaDB
Php: 8.0.30
memory_limit: 8192M
max_execution_time: 15000

I have quite old installation dating back to mautic 2, would really like to not loose all the data or be stuck on the old version of mautic. Its the first time i’m having such a hard time with an update.
Tried different php versions, with and without doctrine:migrations:migrate beforehand, but the update always breaks with php error.

The mautic:update:apply works, but the second stage with the --finish throws such error:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2461696 bytes) in /home/klient.dhosting.pl/thario/test/vendor/symfony/dependency-injection/ContainerBuilder.php on line 1607

I dont see anything relevant in the log regarding this.

What might be a solution to this problem?

Regardless of what you may think how you configured your server…

PHP Fatal error: Allowed memory size of 134217728 bytes

128MB of RAM allocated per PHP process is a bit on the short side.

Try pumping it up to at least 512MB (if not 1024MB or more)

I contacted my hosting provider, and they confirmed that they also see 8192M limit.
Is there somewhere in mautic something that might limit it apart from the server configuration?

However when they initiated the update there was a different error before the --finish stage.

[2024-05-10T10:00:06.683577+02:00] console.CRITICAL: Error thrown while running command “mautic:segments:update”. Message: “An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘l0_.last_built_time’ in ‘field list’” {“exception”:“[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 1054): An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘l0_.last_built_time’ in ‘field list’ at /home/klient.dhosting.pl/thario/test/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:67)\n[previous exception] [object] (Doctrine\DBAL\Driver\PDO\Exception(code: 1054): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘l0_.last_built_time’ in ‘field list’ at /home/klient.dhosting.pl/thario/test/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘l0_.last_built_time’ in ‘field list’ at /home/klient.dhosting.pl/thario/test/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)”,“command”:“mautic:segments:update”,“message”:“An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘l0_.last_built_time’ in ‘field list’”} {“hostname”:“web03-s206.ewh.eu1.dhosting.com”,“pid”:884214}

Is there a way to export the database and import it to a new updated instance? Would be probably easier than trying to find the problem.

The initial error is self explanatory and crystal clear (you can rarely go wrong by trusting it)

php ini override could be found in your htaccess files, ini files of php files (AFAIK there is none in Mautic core files).

Also, some L1 helpdesk may get confused between the allocated resources for the environment and the per process allocated resources.

With that said, crashing a process during the execution of it can cause unwanted side effects (like doing incomplete SQL transactions).

You may need to restore the SQL backup that you did just before initiating the task.

Go in Mautic to the gear icon/System Info/PHP info and check what it shows for you on the memory_limit entry

Unfortunately it shows the value correctly as defined in .htaccess - 8192M, also when I change the value in .htaccess it changes in mautic system info.

I tried a cheesy way to load this database into 5.0.3 instance and do the doctrine:migrate, but cheesy is not the way in IT, it breaks.

I’m quite out of ideas how to trouble shoot this, it would be good to know the problem, but in general the priority is to be able to update to the new versions of mautic.