Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-26580

Upgrading a 1.9.10+ site to 2.0.2+ site fails with a "Maximum execution time of 300 seconds exceeded error"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Installation
    • Labels:
    • Environment:
    • Database:
      Microsoft SQL
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      I'm running into a timeout problem when I upgrade a Moodle 1.9.10+ site to Moodle 2.0.2+ (Build: 20110221). The site is running under IIS 6 on Windows Server 2003 and MSSQL 2005. I started the Moodle upgrade and everything seemed to go ok. Then after about 25 minutes the Moodle upgrade screen displayed a message saying "Migrated course files" and "Migrated user icons". Each showed 100% as the result. Then the upgrade seemed to halt with no other messages.

      After about an hour I looked in the PHP Error log file (I've configured php.ini to write all errors to a log file: error_log = "C:\PHP\PHPErrors.log") and I saw the following error:

      [23-Feb-2011 07:50:11] PHP Fatal error: Maximum execution time of 300 seconds exceeded in D:\Moodle\lib\dml\sqlsrv_native_moodle_database.php on line 356

      Some research indicated that this is a PHP timeout problem so I increased the following PHP configuration settings to very high values:
      max_execution_time = 1800
      max_input_time = 1800
      session.gc_maxlifetime = 1800

      I also increased the following FastCGI configuration settings to very high values:

      ActivityTimeout=1800
      RequestTimeout=1800
      IdleTimeout=1800

      Then I edited the IIS metabase and increased the IIS CGITimeout value to a high value: CGITimeout="1800"

      After restarting the web server and restoring my 1.9.10 site I tried to run the Moodle 2.0.2+ upgrade again. Once again I got the "Maximum execution time of 300 seconds exceeded in D:\Moodle\lib\dml\sqlsrv_native_moodle_database.php on line 356" error.

      Despite making all the above PHP and IIS configuration changes the upgrade still crashing after 300 seconds. All the googling that I was able to do indicated that this timeout can be adjusted by increasing the PHP max_execution_time and max_input_time values, but this obviously hasn't worked for me.

      Line 356 in \lib\dml\sqlsrv_native_moodle_database.php contains the do_query() function with:

      $result = sqlsrv_query($this->sqlsrv, $sql);

      So, it looks like sqlsrv_query() is taking too long to complete and IIS (or PHP??) is timing out after 300 seconds instead of obeying the new ActivityTimeout and RequestTimeout PHP values that I've set.

      Is there someway that I can alter the do_query() function so that it can "ping" the web server to let it know that the script is still running and thus prevent the timeout?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: