Hi! it seems the pua module in send_subscribe ( ) is leaking some memory because the hentity is not released.
According to memory allocations the shmem allocated for hentity is not cleaned.

1454582 file = 0x70e59fd30209 "usrloc: ../../core/ut.h", func = 0x70e59fd326c8 <__func__.16> "shm_str_dup", mname = 0x70e59fd2fdf0 "usrloc", line = 722
 698090 file = 0x604218f2fcd5 "core: core/xavp.c", func = 0x604218f31988 <__func__.9> "xavp_new_value", mname = 0x604218f2fcd0 "core", line = 100
 360187 file = 0x70e59fd30663 "usrloc: ucontact.c", func = 0x70e59fd326b8 <__func__.17> "new_ucontact", mname = 0x70e59fd2fdf0 "usrloc", line = 94
  34208 file = 0x70e59fc91ae9 "pua: send_subscribe.c", func = 0x70e59fc94c80 <__func__.2> "subscribe_cbparam", mname = 0x70e59fc917e0 "pua", line = 773
   5569 file = 0x70e59fc91ae9 "pua: send_subscribe.c", func = 0x70e59fc94ca0 <__func__.1> "subs_cbparam_indlg", mname = 0x70e59fc917e0 "pua", line = 861
     64 file = 0x70e5a231f424 "tmx: tmx_pretran.c", func = 0x70e5a2320230 <__func__.0> "tmx_check_pretran", mname = 0x70e5a231f420 "tmx", line = 271
     64 file = 0x70e5a231f424 "tmx: tmx_pretran.c", func = 0x70e5a2320230 <__func__.0> "tmx_check_pretran", mname = 0x70e5a231f420 "tmx", line = 250
      7 file = 0x70e59fc86854 "pua: event_list.c", func = 0x70e59fc86ad0 <__func__.1> "add_pua_event", mname = 0x70e59fc86850 "pua", line = 72
      3 file = 0x70e5a297c249 "license: ../../core/ut.h", func = 0x70e5a297d4f8 <__func__.3> "shm_str_dup", mname = 0x70e5a297c000 "license", line = 722
      3 file = 0x70e59fd329d4 "usrloc: udomain.c", func = 0x70e59fd35660 <__func__.22> "build_stat_name", mname = 0x70e59fd328a0 "usrloc", line = 56

According to mod_stats for shmem over RPC the pua module was taking double as much memory as usrloc on the busy system.

I have tried to address the issue shown on lines 773 and 861 and added clearing of hentity at the end of send_subscribe () :
but it had caused the subscribe_200 outside of dialog to crash kamailio because of running the tm callback that accesses the hentity which is already free'd

So I thought perhaps another approach is required and the tm callback should clean it, while I must say i do not 100% clear understand why this needs to be so complicated compared to other modules. Perhaps i have missed another bug and overcomplicated things because the uac_r seems to be cleaned just fine.
The issue around the hentity does not seem to be solved in the latest releases while this is 5.3-something custom build.

Anyway my last resort that could help is convert to use tm to clear memory once it is done, in tm/uac.c : t_uac_prepare() is registering a callback with release function

	if(uac_r->cb && insert_tmcb(&(new_cell->tmcb_hl), uac_r->cb_flags,
								*(uac_r->cb), uac_r->cbp, NULL)!=1){
		ret=E_OUT_OF_MEM;
		LM_ERR("short of tmcb shmem\n");
		goto error1;
	}
int insert_tmcb(struct tmcb_head_list *cb_list, int types,
				transaction_cb f, void *param,
				release_tmcb_param rel_func)
{

is there any example of using such a relfunc in the other modules? Or anyone else has see the pua causing a mem leak when it is subscribed to reginfo from the config? I would appreciate some ideas what could be the issue and the solution.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3928@github.com>