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

core\task\h5p_get_content_types_task PHP timeouts

XMLWordPrintable

    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_38_STABLE
    • MDL-68579-master
    • Hide

      SETUP

      To test this issue you are able to run behat tests and edit some file PHP  on your Moodle installation.

      Testing Scenario: Check the h5p_get_content_types_task does not work with behat tests

      1. Before initializing behat you should:
        1. Put into lib/tests/behat the attached test file checkh5p.feature
        2. Edit lib/db/tasks.php file. Find the 'core\task\h5p_get_content_types_task' array configuration and change the values of minute, hour and day fields to '*' value.
        3. Confirm the array looks like:

          array(
                  'classname' => 'core\task\h5p_get_content_types_task',
                  'blocking' => 0,
                  'minute' => '*',
                  'hour' => '*',
                  'day' => '*',
                  'dayofweek' => '*',
                  'month' => '*'
              ),
          

        4. Edit lib/classes/task/h5p_get_content_types_task.php file and add the next code mtrace("H5P task does not run because BEHAT SITE IS RUNNING"); inside the if defined('BEHAT_SITE_RUNNING') condition.
        5. Confirm the code looks like:

          if (defined('BEHAT_SITE_RUNNING')) {
               mtrace("H5P task does not run because BEHAT SITE IS RUNNING");
               return true;
          }
          

      2. Now, you can initialize the behat
        1. For instance, php admin/tool/behat/cli/init.php
        2. Or if you use MDK, mdk behat --force
      3. Run the feature test:

        vendor/bin/behat --format="moodle_progress"  --format="pretty" --config=/path/to/behatdataroot/behatrun/behat/behat.yml --tags=@h5p_task

      1. Expected result: Confirm the behat test run with no errors and you should see in the console the next result: 1 scenario (1 passed) 3 steps (3 passed) 
      Show
      SETUP To test this issue you are able to run behat tests and edit some file PHP  on your Moodle installation. Testing Scenario: Check the h5p_get_content_types_task does not work with behat tests Before initializing behat you should: Put into lib/tests/behat the attached test file checkh5p.feature Edit lib/db/tasks.php file. Find the 'core\task\h5p_get_content_types_task' array configuration and change the values of minute, hour and day fields to '*' value. Confirm the array looks like: array( 'classname' => 'core\task\h5p_get_content_types_task' , 'blocking' => 0 , 'minute' => '*' , 'hour' => '*' , 'day' => '*' , 'dayofweek' => '*' , 'month' => '*' ), Edit lib/classes/task/h5p_get_content_types_task.php file and add the next code  mtrace("H5P task does not run because BEHAT SITE IS RUNNING");  inside the if defined('BEHAT_SITE_RUNNING') condition. Confirm the code looks like: if (defined( 'BEHAT_SITE_RUNNING' )) { mtrace( "H5P task does not run because BEHAT SITE IS RUNNING" ); return true ; } Now, you can initialize the behat For instance, php admin/tool/behat/cli/init.php Or if you use MDK, mdk behat --force Run the feature test: vendor/bin/behat --format= "moodle_progress"   --format= "pretty" --config=/path/to/behatdataroot/behatrun/behat/behat.yml --tags= @h5p_task Expected result:  Confirm the behat test run with no errors and you should see in the console the next result: 1 scenario (1 passed) 3 steps (3 passed)  

      Recently we have started to get a number of unexpected failures in various CI jobs. Apparently random scenarios.

      Looking to logs we have seen that this seems to be the ultimate cause for many of them:

      Execute scheduled task: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)
      ... started 22:36:06. Current memory use 7.6MB.
       
      Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/h5p/h5plib/v124/joubel/core/h5p.classes.php on line 896
      

      ^^^ normally with the cron execution step being the cause. Hence, any scenario / test running cron... is now susceptible to fail because of that.

      This is about to avoid that problem, not sure if controlling the request time, if avoiding the execution or what (hopefully not by raising time limits because that may have a awful multiplicative effect in testing times).

      That's the problem, anyway. Here there are some failed runs, as example:

            cescobedo Carlos Escobedo
            stronk7 Eloy Lafuente (stronk7)
            Victor Déniz Falcón Victor Déniz Falcón
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour, 35 minutes
                1d 1h 35m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.