Execution timeout during 16.10 upgrade when fixing broken user data

Bug #1636090 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Ghada El-Zoghbi
16.10
Fix Released
High
Ghada El-Zoghbi
17.04
Fix Released
High
Ghada El-Zoghbi

Bug Description

Mahara: 16.10.0
DB: Postgres
OS: Linux
Browser: FF

While upgrading from 16.04 to 16.10, we are getting the following error:

PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/clients/mahara/htdocs/lib/mahara.php on line 1569
PHP Stack trace:
PHP 1. {main}() /var/www/clients/mahara/htdocs/admin/cli/upgrade.php:0
PHP 2. upgrade_mahara() /var/www/clients/mahara/htdocs/admin/cli/upgrade.php:53
PHP 3. upgrade_core() /var/www/clients/mahara/htdocs/lib/mahara.php:265
PHP 4. xmldb_core_upgrade() /var/www/clients/mahara/htdocs/lib/upgrade.php:347
PHP 5. set_profile_field() /var/www/clients/mahara/htdocs/lib/db/upgrade.php:4733
PHP 6. safe_require() /var/www/clients/mahara/htdocs/lib/user.php:536

We have over 45K users in the DB and it's timing out.

I've fixed it by adding the following immediately after 'if ($oldversion < 2016090206) {':

        $cur_max_execution_time = @ini_get('max_execution_time');
        ini_set('max_execution_time', 0);

And, at the end of the if statement (to set the time back to the original timeout):
        ini_set('max_execution_time', $cur_max_execution_time);

I didn't use raise_time_limit(0) as it didn't seem to make a difference. It still timeout after 30 seconds.

Thanks,
Ghada

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/7204

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7204
Committed: https://git.mahara.org/mahara/mahara/commit/a09bd7af929d987acc296a38d684cf66f2922af8
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit a09bd7af929d987acc296a38d684cf66f2922af8
Author: Ghada El-Zoghbi <email address hidden>
Date: Mon Oct 24 17:59:09 2016 +1100

Bug #1636090: Increase execution time during fix for users during upgrade.

Large Maharas with thousands of users run into max execution
time errors.

behatnotneeded

Change-Id: Ie9d5e9d1edb6cd3682afb93e435ebb2d01be355e

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "16.10_STABLE" branch: https://reviews.mahara.org/7205

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7205
Committed: https://git.mahara.org/mahara/mahara/commit/bd5e7de413f3c6062891bc583eefcc25e2dd7fa0
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.10_STABLE

commit bd5e7de413f3c6062891bc583eefcc25e2dd7fa0
Author: Ghada El-Zoghbi <email address hidden>
Date: Mon Oct 24 17:59:09 2016 +1100

Bug #1636090: Increase execution time during fix for users during upgrade.

Large Maharas with thousands of users run into max execution
time errors.

behatnotneeded

Change-Id: Ie9d5e9d1edb6cd3682afb93e435ebb2d01be355e

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.