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

/calendar/export_execute.php Allowed memory size exhausted

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MDL-75876-master
    • Hide

      It's hard to generate a large iCal file. We just need to make sure the Export feature still works as expected.

      Initial setup

      1. Login as admin.
      2. Navigate to the Calendar page.
      3. Create several events.

      Testing

      1. Navigate to the Calendar Export page.
      2. Select All events and Custom range.
      3. Click Export.
      4. Verify that the export process is successful.
      5. Click on Get Calendar URL.
      6. Copy the Calendar URL.
      7. Open it in a new tab.
      8. Verify that the browser will download the iCal file.
      9. Verify that the download process is successful.
      Show
      It's hard to generate a large iCal file. We just need to make sure the Export feature still works as expected. Initial setup Login as admin. Navigate to the Calendar page. Create several events. Testing Navigate to the Calendar Export page. Select All events and Custom range. Click Export. Verify that the export process is successful. Click on Get Calendar URL. Copy the Calendar URL. Open it in a new tab. Verify that the browser will download the iCal file. Verify that the download process is successful.

      Step to replicate:
      1. Go to: "/calendar/export.php"
      2. Select as much data as possible. The files which failed to export in our case was ~26 MB
      3. Click get calendar url and save it in your clipboard
      4. Go to: "/calendar/import.php"
      4. Enter a name, set import from: "Calendar URL" and paste your clipboard into the calendar url, click import calendar.
      5. Run the \core\task\calendar_cron_task scheduled task
      6. The requests performed by the scheduled task should now cause a memory exhaustion. (the requests to /calendar/export_execute.php)

       

      /calendar/export_execute.php uses a lot of memory, but does not call raise_memory_limit().

      This can cause a memory exhaustion when working with large amounts of data.

      We've tested the patch on our live server and it fixed our issue.

      Stack trace:
      PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/example.com/moodle/calendar/classes/local/event/factories/event_abstract_factory.php on line 146

        1. MDL-75876_master.mp4
          1.17 MB
        2. MDL-75876_v311.mp4
          1.54 MB
        3. MDL-75876_v400.mp4
          1.32 MB

            frederikmillingpytlick Frederik Milling Pytlick
            frederikmillingpytlick Frederik Milling Pytlick
            Paul Holden Paul Holden
            Huong Nguyen Huong Nguyen
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 15 minutes
                2h 15m

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