Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19798

Memory leak in API3 EntityTag get operations

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Important
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.14
    • Fix Version/s: 5.4
    • Component/s: CiviCRM API, NYSS
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Contract
    • Verified?:
      No

      Description

      The attached PHP file demonstrates a significant memory leak in API3 EntityTag get operations.

      Change the value of $example (line 7) to 1, 2, or 3 to select the example code to be run.

      • Example=1: EntityTag get, 1 contact:
        Each call increases memory by ~10KB.
      • Example=2: Contact get, 1000 Contacts, plus chained call to EntityTag get:
        Each call increases memory by ~10MB (~10KB / contact)
      • Example=3: Contact get, 1000 Contacts:
        Each call increases memory by ~800B. This is a small amount compared to the EntityTag leak, but perhaps it too should be investigated.

      The memory is recovered after the PHP process is terminated.

      Warning: Example 2 uses memory rapidly. After several iterations of this call on a server with 2GB of RAM, the entire server was brought down and needed to be rebooted!

      File Usage: php api_mem_leak_test.php <civicrm settings file>

        Attachments

        1. api_mem_leak_test.php
          2 kB
          Bob Silvern
        2. memleak.patch
          1 kB
          Hugo do Carmo
        3. sample1-memprof.svg
          42 kB
          Hugo do Carmo
        4. sample2-memprof.svg
          53 kB
          Hugo do Carmo
        5. sample3-memprof.pdf
          13 kB
          Hugo do Carmo
        6. sample3-memprof.svg
          87 kB
          Hugo do Carmo

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bobs0 Bob Silvern
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: