Hi,

I have kamailio v5.0.4 git rev. 5f26a4e8c55cdf5a5a7eaf6864c4f5213d321293 installed on 32bit Debian Wheezy virtual machine (1GB RAM and 1 vCPU) for development and testing of a project.

We need to inspect sip traces to / from webrtc endpoint on kamailio side, for which we use siptrace module with following config,


# ----- siptrace params -----
modparam("siptrace", "trace_on", 1)
modparam("siptrace", "hep_mode_on", 0)
modparam("siptrace", "xheaders_write", 1)
modparam("siptrace", "trace_to_database", 0)
modparam("siptrace", "trace_flag", FLT_SIP_TRACE)
modparam("siptrace", "traced_user_avp", "$avp(traced_user)")
modparam("siptrace", "duplicate_uri", "WEBRTC_SIP_TRACE_ADDRESS")


We observed multiple problems of memleaks and segfaults, here is a summary,

1. Calling sip_trace method without any arguements or with only one arguement (duplicate uri) crashes kamailio with segfault.

https://kamailio.org/docs/modules/5.0.x/modules/siptrace.html#siptrace.f.sip_trace

2. To avoid segfault, either I have to specify both args (i am not sure what to set as 2nd arg, so i used "$ci" for it) OR disable "xheaders_write" module param. However, this causes slow memory leak and in about 48 hours kamailio runs out of memory (sip traffic is less then 10 concurrent users)

https://kamailio.org/docs/modules/5.0.x/modules/siptrace.html#siptrace.p.xheaders_write

3. If we remove siptrace module and use "network:msg" event route in corex module with "send_data" method then we ran in to PV buffer overflow problem (webrtc invites are very big > 10KB). So, I increased "pv_buffer_size" to 16K and "pv_buffer_slots" to 12. Which again crashes kamailio with segfault.

https://kamailio.org/docs/modules/5.0.x/modules/corex.html#async.evr.network_io

https://kamailio.org/docs/modules/5.0.x/modules/corex.html#corex.f.send_data

http://www.kamailio.org/wiki/cookbooks/4.1.x/core#pv_buffer_size

http://www.kamailio.org/wiki/cookbooks/4.1.x/core#pv_buffer_slots


Removing "pv_buffer_slots" from config fixes the crash problem, and right now we are observing kamailio if stays stable.


Thank you.