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

Close session early during file upload process

XMLWordPrintable

    • MOODLE_402_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79617_401_STABLE
    • MDL-79617_403_STABLE
    • MDL-79617_master
    • Hide
      1. In config.php, set $CFG->enable_read_only_sesssions_debug = true;
      2. In your terminal, run `tail -f /var/log/error.log`, where /var/log/error.log is the file PHP's error logs go to.
      3. Create a course, and turn on editing mode.
      4. Add a new File resource.
      5. Enter the name "Test file 1"
      6. In the file picker, select "Add...", "Upload a file", "Browse...", select a file and click "Upload this file".
      7. From your file manager, drag and drop a second file onto the file picker.
      8. Click "Save and return to course".
      9. Add a new File resource.
      10. Enter the name "Test file 2"
      11. Disable Javascript and reload the page.
      12. In the file picker, select "Add...", "Upload a file", "Browse...", select a file and click "Upload this file".
      13. Click "Save and return to course".
      14. Re-enable Javascript and reload the page.
      15. From your file manager, drag and drop another file onto the page, to create a third file resource.
      16. Check the error log output in your terminal
        • Confirm there are no messages like "Script xxx.php mutated the session after it was closed"

       

      Show
      In config.php, set $CFG->enable_read_only_sesssions_debug = true; In your terminal, run `tail -f /var/log/error.log`, where /var/log/error.log is the file PHP's error logs go to. Create a course, and turn on editing mode. Add a new File resource. Enter the name "Test file 1" In the file picker, select "Add...", "Upload a file", "Browse...", select a file and click "Upload this file". From your file manager, drag and drop a second file onto the file picker. Click "Save and return to course". Add a new File resource. Enter the name "Test file 2" Disable Javascript and reload the page. In the file picker, select "Add...", "Upload a file", "Browse...", select a file and click "Upload this file". Click "Save and return to course". Re-enable Javascript and reload the page. From your file manager, drag and drop another file onto the page, to create a third file resource. Check the error log output in your terminal Confirm there are no messages like "Script xxx.php mutated the session after it was closed"  

      During some performance testing on a large site, I found that repository_ajax.php was holding long session locks. In my analysis this accounted for 40% of all session locks lasting more than 10 seconds.

      Looking at the script, it does not appear to mutate the session at all. I have tested setting READ_ONLY_SESSIONS true and $CFG->enable_read_only_sessions_debug, and saw no errors during calls to repository_ajax.php when uploading files.

      Per Brendan's comment below, we should look at closing the session early in the file upload process, and possibly in other repository plugins that do not write to the session.

            marxjohnson Mark Johnson
            marxjohnson Mark Johnson
            Brendan Heywood Brendan Heywood
            Huong Nguyen Huong Nguyen
            Stevani Andolo Stevani Andolo
            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 - 45 minutes
                45m

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