Moodle
  1. Moodle
  2. MDL-32607

upgrade_set_timeout times out for CLI scripts

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.2.3
    • Component/s: Administration
    • Labels:
    • Testing Instructions:
      Hide

      for devs:
      1/ add some sleep(600) + echo to upgrade from 1.9->2.2
      2/ when the upgrade goes to sleep access site using different browser, you might get some bogus errors, close the other browser
      3/ it is expected that the cli upgrade continues after the sleep

      Show
      for devs: 1/ add some sleep(600) + echo to upgrade from 1.9->2.2 2/ when the upgrade goes to sleep access site using different browser, you might get some bogus errors, close the other browser 3/ it is expected that the cli upgrade continues after the sleep
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w18_MDL-32607_m23_upgrade2
    • Rank:
      39534

      Description

      MDL-31553 added a fix to the upgrade_set_timeout function to prevent it timing out the script when running a command-line upgrade, however there is still code which kills the script if it takes longer to run than has been estimated. (This has happened to me in a test upgrade, but unfortunately I no longer have the log to give more details)

        Issue Links

          Activity

          Hide
          Michael Aherne added a comment - - edited

          The attachment "upgrade-hack.patch" is the code I used to hack around this issue. It works, but I'm afraid I don't understand the code well enough to know whether it's the correct answer or just a hack!

          Show
          Michael Aherne added a comment - - edited The attachment "upgrade-hack.patch" is the code I used to hack around this issue. It works, but I'm afraid I don't understand the code well enough to know whether it's the correct answer or just a hack!
          Hide
          Petr Škoda added a comment -

          Thanks for the report and patch, the problem was that the CLI script gets interrupted by any web access once it runs longer than the timeout. Workaround is simple: shut down apache during upgrades, in fact you should always prevent web access during upgrades either via CLI or web.

          Show
          Petr Škoda added a comment - Thanks for the report and patch, the problem was that the CLI script gets interrupted by any web access once it runs longer than the timeout. Workaround is simple: shut down apache during upgrades, in fact you should always prevent web access during upgrades either via CLI or web.
          Hide
          Petr Škoda added a comment -

          Hmm, I think I will implement file based locking for upgrades in some future version, this $CFG->upgraderunning hack may fail in different ways and we can not rely on admins carefully preventing web access during upgrades...

          Show
          Petr Škoda added a comment - Hmm, I think I will implement file based locking for upgrades in some future version, this $CFG->upgraderunning hack may fail in different ways and we can not rely on admins carefully preventing web access during upgrades...
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Sam Hemelryk added a comment -

          Thanks Petr - this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Petr - this has been integrated now
          Hide
          Rajesh Taneja added a comment -

          Upgrade CLI script resumes after sleep. Browser shows "Site is being upgraded, please retry later." message and after upgrade site works fine.

          FYI:
          If sleep is added in upgrade_core (somewhere in middle), it let user to log in to site and show missing plugin's (If it's admin)

          Thanks for fixing this Petr

          Show
          Rajesh Taneja added a comment - Upgrade CLI script resumes after sleep. Browser shows "Site is being upgraded, please retry later." message and after upgrade site works fine. FYI: If sleep is added in upgrade_core (somewhere in middle), it let user to log in to site and show missing plugin's (If it's admin) Thanks for fixing this Petr
          Hide
          Rajesh Taneja added a comment -

          FYI:
          CLI upgrade from 2.2 > master hangs after "->System" for approx 15 min. No activity on screen for approx 15 min, then it resumes fine. (This is on non-modified code, i.e. sleep is not added)

          This is visible on stable and integration branches.

          Show
          Rajesh Taneja added a comment - FYI: CLI upgrade from 2.2 > master hangs after " ->System" for approx 15 min. No activity on screen for approx 15 min, then it resumes fine. (This is on non-modified code, i.e. sleep is not added) This is visible on stable and integration branches.
          Hide
          Eloy Lafuente (stronk7) added a comment -
          UPDATE tracker_issues
             SET status = 'Closed',
                comment = 'Thanks!'
          WHEN participants = 'Did a gorgeous work'
          

          This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).

          Show
          Eloy Lafuente (stronk7) added a comment - UPDATE tracker_issues SET status = 'Closed', comment = 'Thanks!' WHEN participants = 'Did a gorgeous work' This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: