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

Deleting a large database activity module could lead to a memory allocation error crash

    XMLWordPrintable

    Details

    • Database:
      Any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      Trying to delete a large database (more than 3000 records of 20 fields i.e.) crash with error
      PHP Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 71 bytes) in docs/lib/adodb/adodb.inc.php on line 3008

      This happen because the delete function try to do a full left join before deleting all the entries.
      You can find my solution in attachment, where all the entries are deleted using the minimal memory needed to do the job, and an explicit printout of the operation is done to get the client web page responsive during the long operations.

      The attachment contains ONLY the function data_delete_instance modified, to be substituted in docs/mod/data/lib.php

      sincerely yours.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                poltawski Dan Poltawski
                Reporter:
                rabser Sergio Rabellino
                Participants:
                Component watchers:
                Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: