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 Bug
    • Status: Closed
    • Priority: Blocker 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
    • Rank:
      16361

      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?

        Issue Links

          Activity

          Luis de Vasconcelos created issue -
          Eloy Lafuente (stronk7) made changes -
          Field Original Value New Value
          Labels triaged
          Fix Version/s STABLE backlog [ 10463 ]
          Martin Dougiamas made changes -
          Fix Version/s STABLE Sprint 8 [ 10541 ]
          Fix Version/s STABLE backlog [ 10463 ]
          Aparup Banerjee made changes -
          Assignee moodle.com [ moodle.com ] Aparup Banerjee [ nebgor ]
          Aparup Banerjee made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Aparup Banerjee made changes -
          Link This issue will be resolved by PULL-586 [ PULL-586 ]
          Aparup Banerjee made changes -
          Link This issue will be resolved by PULL-587 [ PULL-587 ]
          Martin Dougiamas made changes -
          Fix Version/s STABLE Sprint 9 [ 10550 ]
          Fix Version/s STABLE Sprint 8 [ 10541 ]
          Aparup Banerjee made changes -
          Status In Progress [ 3 ] Ready for review [ 10010 ]
          Resolution Fixed [ 1 ]
          Petr Škoda made changes -
          Resolution Fixed [ 1 ]
          Status Ready for review [ 10010 ] Reopened [ 4 ]
          Aparup Banerjee made changes -
          Link This issue will be resolved by PULL-651 [ PULL-651 ]
          Aparup Banerjee made changes -
          Link This issue will be resolved by PULL-652 [ PULL-652 ]
          Aparup Banerjee made changes -
          Status Reopened [ 4 ] Ready for review [ 10010 ]
          Resolution Fixed [ 1 ]
          Aparup Banerjee made changes -
          Link This issue has been marked as being related by MDL-27251 [ MDL-27251 ]
          Martin Dougiamas made changes -
          Workflow MDL Workflow [ 68200 ] MDL Full Workflow [ 76462 ]
          Aparup Banerjee made changes -
          Status Waiting for review [ 10010 ] Closed [ 6 ]
          Michael de Raadt made changes -
          Link This issue has been marked as being related by MDL-30942 [ MDL-30942 ]
          Eloy Lafuente (stronk7) made changes -
          Fix Version/s STABLE Sprint 9 [ 10550 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: