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

Cron throws exceptions during a cache purge as localcachedir is purged / get_request_storage_directory should use system temp

XMLWordPrintable

    • MOODLE_38_STABLE
    • MOODLE_310_STABLE
    • MDL-66928-request-dir-purge-bug
    • Hide

      1) Add MDL-66928-requestdir-purge.php and run it, this touches a file in a request directory and then polls it to make sure it keeps existing. You can open up a couple of these in different tabs

      2) Purge the caches

      php admin/cli/purge_caches.php

      3) Confirm all of the progress bars still say 'good'

      4) Find your tmp dir on your local box. Note that depending on setup it could be in a magic hidden directory, see:

      https://www.the-art-of-web.com/php/where-is-tmp/

      On my ubuntu box under apache it ends up as:

      /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/

      Now confirm you can find for all requestdirs to see the touch files:

      $ sudo find /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs
      /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs
      /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs/fa73f267-cfb4-4a85-b7a8-4c12da5b9c45
      /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs/fa73f267-cfb4-4a85-b7a8-4c12da5b9c45/544a4333-f942-4445-a226-76f135d36ef7
      /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs/fa73f267-cfb4-4a85-b7a8-4c12da5b9c45/544a4333-f942-4445-a226-76f135d36ef7/touch

      5) kill of the tabs and confirm that each dir is cleaned 

       

      6) Now set an explicit local temp path and repeat all the steps above:

      $CFG->localtempdir = '/var/lib/sitedata/moodle.local/mytemp';

       

       

      Show
      1) Add  MDL-66928 -requestdir-purge.php and run it, this touches a file in a request directory and then polls it to make sure it keeps existing. You can open up a couple of these in different tabs 2) Purge the caches php admin/cli/purge_caches.php 3) Confirm all of the progress bars still say 'good' 4) Find your tmp dir on your local box. Note that depending on setup it could be in a magic hidden directory, see: https://www.the-art-of-web.com/php/where-is-tmp/ On my ubuntu box under apache it ends up as: /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/ Now confirm you can find for all requestdirs to see the touch files: $ sudo find /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs/fa73f267-cfb4-4a85-b7a8-4c12da5b9c45 /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs/fa73f267-cfb4-4a85-b7a8-4c12da5b9c45/544a4333-f942-4445-a226-76f135d36ef7 /tmp/systemd-private-9f3b4bc5268d487b93aea4b0be240825-apache2.service-2FvyhK/tmp/requestdirs/fa73f267-cfb4-4a85-b7a8-4c12da5b9c45/544a4333-f942-4445-a226-76f135d36ef7/touch 5) kill of the tabs and confirm that each dir is cleaned    6) Now set an explicit local temp path and repeat all the steps above: $CFG->localtempdir = '/var/lib/sitedata/moodle.local/mytemp';    

      If you run cron:

      php admin/cli/cron.php

      And it is processing an adhoc task, and then in another terminal you purge the cache:

      php admin/cli/purge_caches.php

      Then after the cache is purged the task logging throws an exception because the temp log data has been removed:

      PHP Warning: file_get_contents(/var/lib/sitedata/moodle.local/localcache/86df757d-a79c-45b8-80d4-d4a9b95da3ca/c8fe4276-6313-4f5d-89b4-8871e68c7a8a/task.log): failed to open stream: No such file or directory in /var/www/moodle.local/lib/classes/task/database_logger.php on line 77

      Warning: file_get_contents(/var/lib/sitedata/moodle.local/localcache/86df757d-a79c-45b8-80d4-d4a9b95da3ca/c8fe4276-6313-4f5d-89b4-8871e68c7a8a/task.log): failed to open stream: No such file or directory in /var/www/moodle.local/lib/classes/task/database_logger.php on line 77

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Matt Porritt Matt Porritt
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 55 minutes
                4h 55m

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