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

Memory leak in session_set_user (forum digest hits memory limit)

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Not sure how to test this. Adding test instructions to make sure forum cron doesn't break.

      1. Enroll 5 users to a course.
      2. Add forum to course and set Subscription mode to Forced subscription
      3. Post discussion to forum by logging as different user
      4. Run cron and make sure every one gets email.
      Show
      Not sure how to test this. Adding test instructions to make sure forum cron doesn't break. Enroll 5 users to a course. Add forum to course and set Subscription mode to Forced subscription Post discussion to forum by logging as different user Run cron and make sure every one gets email.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w21_MDL-32379_m23_forumcron

      Description

      The session_set_user function points $_SESSION['USER'] at the passed object.

      When data is attached to the session user, this bloats out the referenced object, so if a process changes users many times from say, a prefilled list of records, it will hit the memory limit and fail. For example, the forum digest sending is affected by this problem and will fail on any site where a large number of users are to be sent a digest.

      This can be resolved by simply cloning the passed $user object to break the reference.

      Github incoming with a patch.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              tlevi Tony Levi
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Dan Poltawski
              Tester:
              Dan Poltawski
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              8 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Jun/12