Re: Memory leak in smsbox

Alejandro Guerrieri <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Peter,

I'll definitely try it. I've been struggling to find the cause of a
misterious memory-eating smsbox for weeks.

Since I don't master the "debugging skills" I've ended up using
tcptools (the "supervise" program from DJB) and softlimit to deny the
smsbox more memory, so the offending process get killed and restarted,
but I know it's a temporary solution. I think your patch may come in
handy :)

I'll try your patch and let you know if the problem is fixed on my setup.

Best regards,

On 1/20/06, Peter Christensen <[email protected]> wrote:
> Hi,
>
> Earlier today I noticed a significant increase of memory consumption by
> smsbox. Over a period of 5½ hour it had gone from around 1.8MB to
> 209MB. When I examined the log of smsbox, two messages were rejected by
> smsbox due to bad character formatting, but a minute later the client
> attempted to transfer both messages again and again etc.
> Judging from this there must be a memory leak in smsbox which is only
> triggered upon errors.
>
> I went through some memory dumps and smsbox_req_handle and eventually
> concluded that upon errors the allowed, denied, and receiver lists were
> not freed.
>
> I've attached a patch which will free the lists on errors in between the
> creation and destruction of the lists.
>
> As far as I could see, the elements within the three lists are actually
> the same (that is, everything in allowed and denied are definitely also
> in received), and since we have not extracted the elements from the
> receiver yet, this patch only free the elements in the receiver list.
> Not the allowed and denied lists. Is this assumption correct? One thing
> is certain, freeing both receiver and allowed with gwlist_destroy(list,
> octstr_destroy_item) ended in a PANIC since the first destruction freed
> the elements in the other list.
>
>
> A brute spamming with invalid messages made an unpatched newly started
> kannel go from 1.3MB to 10MB in two seconds. The same thing with a
> patched kannel went from 1.3MB to 1.5MB where it stayed (I assume that
> the first bunch was first-time single-shot allocations). The memory
> sizes are RSS.
>
>
> Another unrelated thing... I've been bombing the mailing list with
> patches and stuff the last few weeks, but what exactly is the preferred
> way of getting patches? In the mailing list, or by creating a bug report
> with an attached patch?
>
> --
> Med venlig hilsen / Best regards
>
> Peter Christensen
>
> Developer
> ------------------
> Cool Systems ApS
>
> Tel: +45 2888 1600
> @ : [email protected]
> www: www.coolsystems.dk
>
>
>


--
Alejandro Guerrieri
Magicom
http://www.magicom-bcn.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.