[sr-dev] [tracker] Task opened: Possible memory leak when processing sht_reload

sip-router bugtracker at sip-router.org
Tue Dec 24 08:42:15 CET 2013


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - i (takeshi) 

Attached to Project - sip-router
Summary - Possible memory leak when processing sht_reload
Task Type - Bug Report
Category - Core
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - I am testing reload of htable using 'kamctl fifo sht_reload TABLE_NAME'
This worked fine before and I could issue thousands of such commands without rest.

But with latest commit ef66bf4ce961a7379bb21e848f70d03defb8864c, it fails after about 40 reloads (using the same config file and '-m 1024') with 
  500 ERROR Reloading data
Setting debug=9 didn't clarify the reason so I attached to the "MI FIFO" process with gdb and verified that it goes out at this point in htable.c (inside function ht_mi_reload):

        nht.entries = (ht_entry_t*)shm_malloc(nht.htsize*sizeof(ht_entry_t));
        if(nht.entries == NULL)
        {
                ht_db_close_con();
                return init_mi_tree(500, MI_ERR_RELOAD, MI_ERR_RELOAD_LEN);
        }

The problem is with shm_malloc() so it seems there is a memory leak.


The configuration is just this:
  # ----- htable params -----
  modparam("htable", "db_url", "mysql://kamailio:kamailioro@localhost/kamailio")
  modparam("htable", "htable", "domain=>size=20;dbtable=htable_domain;")

And I am not processing any calls, I just do 'kamctl fifo sht_reload domain' in a loop.

I even added a sleep of 5 minutes between reloads to see if memory eventually gets freed but it failed just the same:
root at LAB002153:sip-router# for i in $(seq 1 50);do echo $i; kamctl fifo sht_reload domain; sleep 300; done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
500 ERROR Reloading data
43
500 ERROR Reloading data
44
500 ERROR Reloading data

I got the memory dump after shutting down kamailio. It is too big for pastebin, so I uploaded to a file sharing service:
http://www.filedropper.com/kamailiolog
But I don't know how to interpret this.

More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=385

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.



More information about the sr-dev mailing list