[Kamailio-Users] Shared memory

Henning Westerholt henning.westerholt at 1und1.de
Mon Mar 22 19:09:33 CET 2010


On Monday 22 March 2010, Bruno Machado wrote:
> I have some questions regarding the shared memory. I'm working with the
>  version 1.5.2 and its environment is quite simple. It does'nt storage any
>  informations in the memory, like dialplan, contacts of subscribers,
>  carrierroute, LCR and etc. The only purpose of this server is being a
>  redirect server. Some calls have several possible destinations, reaching
>  easily 12 contacts. The config.h's constant MAX_BRANCHES is set in 12, the
>  default number. Ok. Like I said, almost the requests have more than 12
>  possible contacts. When it happens, Kamailio logs these messages:
> 
> /usr/local/kamailio-1.5.2/sbin/kamailio[26188]: ERROR:core:append_branch:
>  max nr of branches exceeded
>  /usr/local/kamailio-1.5.2/sbin/kamailio[26188]: ERROR:pv:pv_set_branch:
>  append_branch action failed
> [..]
> /usr/local/kamailio-1.5.2/sbin/kamailio[25492]: ERROR:core:add_avp: no more
>  shm mem /usr/local/kamailio-1.5.2/sbin/kamailio[25492]:
>  ERROR:exec:exec_avp: unable to add avp
> 
> Kamailio stills running but it is not possible to route any request. All
>  the new incoming calls generates the same error: 'no more shm mem'. I
>  changed the size of shared memory, running Kamailio with '-m 64', but the
>  server stopped again after some days. I see the options:
> 
> - increase MAX_BRANCHES
> - increase again 'm' parameter (but it will just add more some days in the
>  running time) - reduce the maximum number of contacts to 11 of the script
>  that returns them to Kamailio
> 
> So, my doubts are:
> 
> - is it possible to have a memory leak when the message "max nr of branches
>  exceeded" is showed? - changing '-m parameter' to a higher value, like
>  256, could affect the performance?

Hi Bruno,

this looks indeed like an memory leak in the code path that is executed during 
the error. Also possible is that there is (really small) mem leak in another 
code path, that gets executed a lot.

Another (unlikely) option could be that this problem is caused from shared 
memory fragmentation, as you noticed that the server gets some traffic. How 
often this error happens? Do you can clearly correlate this to the error logs 
you notice?

Anyway, you should increase the shared memory setting to 512M or higher, 
depending on the system memory. It has no negative performance impact.

Henning



More information about the Users mailing list