You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2017/07/26 20:29:31 UTC

[Bug 7447] New: [PATCH] Memory leak in Mail::Spamassassin::Message

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7447

            Bug ID: 7447
           Summary: [PATCH] Memory leak in Mail::Spamassassin::Message
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Libraries
          Assignee: dev@spamassassin.apache.org
          Reporter: john@fastquake.com
  Target Milestone: Undefined

I've found a memory leak in the Mail::Spamassassin::Message module. The Message
object initializes the parse_queue array with one element which contains a
reference back to the Message object. parse_queue is deleted when parse_body()
is called. However, if parse_body() is never called before the Message object
is destroyed, the array will remain with the circular reference inside it and
the whole object will leak.

This usually isn't serious because parse_body() or something that calls it is
usually called before the message is destroyed. But this isn't guaranteed. In
particular, one code path in sa-learn (when the message to be learned contains
SpamAssassin headers) will trigger this leak, and with many messages (~30k)
this can easily cause sa-learn to consume gigabytes of memory.

The attached patch addresses this by deleting parse_queue in the finish()
routine.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7447] [PATCH] Memory leak in Mail::Spamassassin::Message

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7447

--- Comment #3 from Karsten Bräckelmann <gu...@rudersport.de> ---
Can confirm receipt of an ICLA by John Brooks, filed in the Apache Software
Foundation records. Added John to the hascla group accordingly, to reflect this
status in the attachment / patch details.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7447] [PATCH] Memory leak in Mail::Spamassassin::Message

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7447

Karsten Bräckelmann <gu...@rudersport.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Karsten Bräckelmann <gu...@rudersport.de> ---
Good spot. Thanks for your report and patch, John.

Committed to trunk and stable 3.4 branch.

Sending        lib/Mail/SpamAssassin/Message.pm
Committed revision 1804337.

Sending        lib/Mail/SpamAssassin/Message.pm
Committed revision 1804338.

Closing RESOLVED FIXED.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7447] [PATCH] Memory leak in Mail::Spamassassin::Message

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7447

John Brooks <jo...@fastquake.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john@fastquake.com

--- Comment #1 from John Brooks <jo...@fastquake.com> ---
Created attachment 5459
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5459&action=edit
Delete parse_queue in Message::finish() to prevent memory leak

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7447] [PATCH] Memory leak in Mail::Spamassassin::Message

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7447

--- Comment #2 from John Brooks <jo...@fastquake.com> ---
I sent in my ICLA. Can someone look at this now? And my other (less important)
patch that's been sitting for over a year
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7296

-- 
You are receiving this mail because:
You are the assignee for the bug.