Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.18, 0.20
    • Fix Version/s: 0.21
    • Component/s: None
    • Labels:
      None
    • Environment:

      RHEL5, RHEL6

      Description

      I've been having problems with long running code using the perl bindings leaking memory, specifically after calls to getProperties and decodeMap.

      To reproduce - edit drain.pl to call $receiver->setCapacity(100) and then run drain.pl -f amq.match. You'll also need to hack map_sender.pl to send to amq.match and loop forever (both attached). The memory usage of drain.pl will now start growing...

      1. qpid-perl-memory.diff
        4 kB
        Jimmy Jones
      2. map-leak.pl
        0.2 kB
        Jimmy Jones
      3. map-leak.diff
        1 kB
        Jimmy Jones
      4. map_sender.pl
        0.7 kB
        Jimmy Jones
      5. drain.pl
        4 kB
        Jimmy Jones

        Activity

        Hide
        Darryl L. Pierce added a comment -

        I found the problem exists even without the larger capacity: it just takes a lot longer to show up. I ran the above setup but without setting the capacity and found that, after 2.5 hours, memory had leaked to 2.8% of available in Perl.

        Talking with someone else here who mentioned a similar memory leak in Perl bindings generated in Swig. He's getting me some details for how they diagnosed the problem and hopefully that will lend itself to the solution.

        Show
        Darryl L. Pierce added a comment - I found the problem exists even without the larger capacity: it just takes a lot longer to show up. I ran the above setup but without setting the capacity and found that, after 2.5 hours, memory had leaked to 2.8% of available in Perl. Talking with someone else here who mentioned a similar memory leak in Perl bindings generated in Swig. He's getting me some details for how they diagnosed the problem and hopefully that will lend itself to the solution.
        Hide
        Jimmy Jones added a comment -

        Simpler example of leak

        Show
        Jimmy Jones added a comment - Simpler example of leak
        Hide
        Jimmy Jones added a comment -

        The attached patch seems to fix the leak. However I don't claim to have any understanding of perl object mortality, so probably should be checked by a perl pro before applying! Might be a good idea to check the rest of the code too for similar problems.

        Show
        Jimmy Jones added a comment - The attached patch seems to fix the leak. However I don't claim to have any understanding of perl object mortality, so probably should be checked by a perl pro before applying! Might be a good idea to check the rest of the code too for similar problems.
        Hide
        Darryl L. Pierce added a comment -

        Thanks for the patch. This seems to have fixed the problem. I ran a few tests while monitoring memory. The Perl process never went above 0.1% memory usage the whole time (about 30 minutes).

        Show
        Darryl L. Pierce added a comment - Thanks for the patch. This seems to have fixed the problem. I ran a few tests while monitoring memory. The Perl process never went above 0.1% memory usage the whole time (about 30 minutes).
        Hide
        Jimmy Jones added a comment -

        Just done some testing with maps inside maps and get lots of internal perl errors...

        Show
        Jimmy Jones added a comment - Just done some testing with maps inside maps and get lots of internal perl errors...
        Hide
        Jimmy Jones added a comment -

        New patch with testcase that doesn't leak memory or produce internal perl errors

        Show
        Jimmy Jones added a comment - New patch with testcase that doesn't leak memory or produce internal perl errors
        Hide
        Jimmy Jones added a comment -

        NB. testcases seem to the failing, also they no longer exercise decoding as set_context caches the content, so get_content doesn't need to decode.

        Show
        Jimmy Jones added a comment - NB. testcases seem to the failing, also they no longer exercise decoding as set_context caches the content, so get_content doesn't need to decode.
        Hide
        Darryl L. Pierce added a comment -

        Pushed the fix.

        Show
        Darryl L. Pierce added a comment - Pushed the fix.

          People

          • Assignee:
            Darryl L. Pierce
            Reporter:
            Jimmy Jones
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development