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

    • Any
    • MOODLE_19_STABLE
    • Easy

      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.

        1. lib.php
          2 kB
          Sergio Rabellino

            poltawski Dan Poltawski
            rabser Sergio Rabellino
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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