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

Memory issue in Train models task

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.10, 4.2.7, 4.3
    • Analytics
    • None

      we're hitting a memory limit with the train models task in Moodle's analytics
      PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 134217736 bytes)

      due to this line:
      https://github.com/moodle/moodle/blob/master/analytics/classes/analysis.php#L533

      The way I read that code is:

      wait until we have over 1000 records, then run an insert - this part makes sense:
      https://github.com/moodle/moodle/blob/master/analytics/classes/analysis.php#L528

      But then it takes the first 1000 records from that array and passes it to the insert_records call and anything over that it saves in the $newcalculations var to deal with on the next loop - but I'm not clear why it's actually doing this as array_splice just seems to result in more memory usage than less.

      I think we just need to pull out the array_splice and just send the full array to insert_records rather than keeping back the extra items in the array over 1000

      I'll try to get a PR for this, although testing analytics is always a bit problematic so it might sit here for a while....

            Unassigned Unassigned
            danmarsden Dan Marsden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

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