[OpenSIPS-Users] Does not release shared memory

Liviu Chircu liviu at opensips.org
Fri Jul 21 16:52:20 EDT 2017


Hi, dgoni!

That's not a really fair test, IMO. There are plenty of one-time buffer 
allocations happening in all sorts of modules. Can you please confirm if 
your diagnostic is still valid even after you run some more calls 
through OpenSIPS? The leak should be obvious in the memory map, too - 
this isn't the case now.

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.coaf

On 21.07.2017 21:31, dgoni_sp via Users wrote:
> Hello!
>
> Please, tell me.
> Opensips for some reason does not release shared memory (shmem), it was
> tested as in the documentation
> "https://www.opensips.org/Documentation/TroubleShooting-OutOfMem". Waited
> more than 20 minutes. Now I want to get a memory dump. I tried the same
> results on versions 2.2.5 and 2.3.1. Set for comparison kamailio, with a
> similar configuration, the memory is freed immediately, once the call is
> completed. What could be the problem ?
> Opensips v.2.3.1 OC CentOS 7 (virtual machine)
> At startup
>
> [root at new-centos7 ~]# /usr/local/opensips225/sbin/opensipsctl start
>
> INFO: Starting OpenSIPS :
> INFO: started (pid: 4274)
>
> [root at new-centos7 ~]# /usr/local/opensips225/sbin/opensipsctl fifo
> get_statistics shmem:
> shmem:total_size:: 33554432
> shmem:used_size:: 3271272
> shmem:real_used_size:: 3557488
> shmem:max_used_size:: 3557488
> shmem:free_size:: 29996944
> shmem:fragments:: 490
>
> I made one call.
>
> [root at new-centos7 ~]# /usr/local/opensips225/sbin/opensipsctl fifo
> get_statistics shmem:
> shmem:total_size:: 33554432
> shmem:used_size:: 3336136
> shmem:real_used_size:: 3632024
> shmem:max_used_size:: 3635208
> shmem:free_size:: 29922408
> shmem:fragments:: 577
> [root at new-centos7 ~]#
>
> In 20 minutes.
>
> [root at new-centos7 ~]# /usr/local/opensips225/sbin/opensipsctl fifo
> get_statistics shmem:
> shmem:total_size:: 33554432
> shmem:used_size:: 3336136
> shmem:real_used_size:: 3632024
> shmem:max_used_size:: 3635208
> shmem:free_size:: 29922408
> shmem:fragments:: 577
>
> Stopped
> [root at new-centos7 ~]# /usr/local/opensips225/sbin/opensipsctl stop
>
> INFO: Stopping OpenSIPS :
> INFO: stopped
> [root at new-centos7 ~]#
>
> Dump memory
> 2017-07-21T18:44:57.5212 B2BUA Memory status (pkg):
> 2017-07-21T18:44:57.5212 B2BUA qm_status (0x7f1d017fe010):
> 2017-07-21T18:44:57.5213 B2BUA  heap size= 2097152
> 2017-07-21T18:44:57.5214 B2BUA  used= 63904, used+overhead=350224,
> free=1746928
> 2017-07-21T18:44:57.5215 B2BUA  max used (+overhead)= 355224
> 2017-07-21T18:44:57.5216 B2BUA  dumping summary of all alloc'ed. fragments:
> 2017-07-21T18:44:57.5217 B2BUA          32 : 2 x [script_var.c: add_var,
> line 59]
> 2017-07-21T18:44:57.5218 B2BUA       14400 : 72 x [route_struct.c:
> mk_action, line 106]
> 2017-07-21T18:44:57.5218 B2BUA          80 : 2 x [cfg.y: mk_listen_id, line
> 2785]
> 2017-07-21T18:44:57.5219 B2BUA          48 : 1 x [ipc.c:
> ipc_register_handler, line 50]
> 2017-07-21T18:44:57.5220 B2BUA         320 : 2 x [db/db.c: db_do_init, line
> 321]
> 2017-07-21T18:44:57.5220 B2BUA          80 : 2 x [pvar.c: new_pv_context,
> line 4745]
> 2017-07-21T18:44:57.5221 B2BUA          96 : 2 x [script_var.c: add_var,
> line 52]
> 2017-07-21T18:44:57.5222 B2BUA          64 : 1 x [ds_fixups.c:
> set_list_from_string, line 226]
> 2017-07-21T18:44:57.5223 B2BUA          16 : 1 x [ds_fixups.c:
> ds_select_fixup, line 730]
> 2017-07-21T18:44:57.5224 B2BUA          96 : 2 x [sr_module_deps.c:
> alloc_module_dep, line 54]
> 2017-07-21T18:44:57.5225 B2BUA         128 : 1 x [net/net_tcp.c: tcp_init,
> line 1633]
> 2017-07-21T18:44:57.5226 B2BUA          80 : 1 x [mi/mi_trace.c:
> try_load_trace_api, line 55]
> 2017-07-21T18:44:57.5226 B2BUA          24 : 1 x [mod_fix.c: fixup_spve,
> line 938]
> 2017-07-21T18:44:57.5227 B2BUA          32 : 2 x [socket_info.c:
> new_sock_info, line 116]
> 2017-07-21T18:44:57.5228 B2BUA         192 : 15 x [map.c: map_get, line 150]
> 2017-07-21T18:44:57.5229 B2BUA          32 : 1 x [map.c: map_create, line
> 79]
> 2017-07-21T18:44:57.5229 B2BUA          48 : 2 x [socket_info.c:
> fix_socket_list, line 670]
> 2017-07-21T18:44:57.5230 B2BUA         184 : 5 x [mod_fix.c: fixup_sgp, line
> 771]
> 2017-07-21T18:44:57.5231 B2BUA          24 : 1 x [ds_fixups.c:
> set_list_from_string, line 197]
> 2017-07-21T18:44:57.5232 B2BUA        4928 : 37 x [pvar.c: pv_parse_format,
> line 4099]
> 2017-07-21T18:44:57.5232 B2BUA        1768 : 17 x [cfg.y: yyparse, line
> 2299]
> 2017-07-21T18:44:57.5233 B2BUA          32 : 2 x [socket_info.c:
> fix_socket_list, line 591]
> 2017-07-21T18:44:57.5234 B2BUA        2496 : 24 x [cfg.y: yyparse, line
> 1464]
> 2017-07-21T18:44:57.5235 B2BUA          24 : 1 x [ds_fixups.c:
> set_list_from_string, line 146]
> 2017-07-21T18:44:57.5236 B2BUA       26240 : 205 x [cfg.lex: addstr, line
> 919]
> 2017-07-21T18:44:57.5237 B2BUA         480 : 2 x [socket_info.c:
> new_sock_info, line 111]
> 2017-07-21T18:44:57.5237 B2BUA        4216 : 1 x [mi/mi.c: register_mi_cmd,
> line 146]
> 2017-07-21T18:44:57.5238 B2BUA         104 : 1 x [ds_fixups.c:
> set_list_from_string, line 232]
> 2017-07-21T18:44:57.5239 B2BUA        1792 : 32 x [route_struct.c: mk_elem,
> line 70]
> 2017-07-21T18:44:57.5239 B2BUA          72 : 2 x [socket_info.c:
> fix_socket_list, line 540]
> 2017-07-21T18:44:57.5240 B2BUA          32 : 2 x [cfg.y: yyparse, line 519]
> 2017-07-21T18:44:57.5241 B2BUA          16 : 1 x [b2b_logic.h:
> prepare_b2b_scen_fl_struct, line 179]
> 2017-07-21T18:44:57.5241 B2BUA         104 : 1 x [context.c:
> register_context_destroy, line 74]
> 2017-07-21T18:44:57.5242 B2BUA        4104 : 1 x [xlog.c: buf_init, line 69]
> 2017-07-21T18:44:57.5243 B2BUA          48 : 2 x [cfg.y: yyparse, line 1162]
> 2017-07-21T18:44:57.5244 B2BUA         128 : 3 x [sipmsgops.c: fixup_method,
> line 892]
> 2017-07-21T18:44:57.5245 B2BUA         504 : 9 x [route_struct.c: mk_exp,
> line 54]
> 2017-07-21T18:44:57.5245 B2BUA         840 : 15 x [map.c: map_get, line 139]
> 2017-07-21T18:44:57.5246 B2BUA  dumping free list stats :
> 2017-07-21T18:44:57.5247 B2BUA hash=   5. fragments no.:     1, unused:
> 0#012#011#011 bucket size:        40 -        40 (first        40)
> 2017-07-21T18:44:57.5248 B2BUA hash=   6. fragments no.:    11, unused:
> 0#012#011#011 bucket size:        48 -        48 (first        48)
> 2017-07-21T18:44:57.5249 B2BUA hash=  19. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       152 -       152 (first       152)
> 2017-07-21T18:44:57.5250 B2BUA hash=  23. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       184 -       184 (first       184)
> 2017-07-21T18:44:57.5250 B2BUA hash=  29. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       232 -       232 (first       232)
> 2017-07-21T18:44:57.5251 B2BUA hash= 181. fragments no.:     1, unused:
> 0#012#011#011 bucket size:      1448 -      1448 (first      1448)
> 2017-07-21T18:44:57.5252 B2BUA hash= 302. fragments no.:     1, unused:
> 0#012#011#011 bucket size:      2416 -      2416 (first      2416)
> 2017-07-21T18:44:57.5253 B2BUA hash= 2055. fragments no.:     1, unused:
> 0#012#011#011 bucket size:   1048576 -   2097152 (first   1741928)
> 2017-07-21T18:44:57.5254 B2BUA -----------------------------
> 2017-07-21T18:44:57.5255 B2BUA shm_free(0x7f1cffb592a8), called from main.c:
> cleanup(337)
> 2017-07-21T18:44:57.5256 B2BUA freeing frag. 0x7f1cffb59270 alloc'ed from
> pt.c: init_multi_proc_support(69)
> 2017-07-21T18:44:57.5256 B2BUA Memory status (shm):
> 2017-07-21T18:44:57.5257 B2BUA qm_status (0x7f1cff7fe000):
> 2017-07-21T18:44:57.5258 B2BUA  heap size= 33554432
> 2017-07-21T18:44:57.5258 B2BUA  used= 2856, used+overhead=245912,
> free=33308520
> 2017-07-21T18:44:57.5259 B2BUA  max used (+overhead)= 3635208
> 2017-07-21T18:44:57.5260 B2BUA  dumping summary of all alloc'ed. fragments:
> 2017-07-21T18:44:57.5261 B2BUA          16 : 2 x [statistics.c:
> register_udp_load_stat, line 160]
> 2017-07-21T18:44:57.5262 B2BUA         280 : 2 x [statistics.c:
> register_udp_load_stat, line 152]
> 2017-07-21T18:44:57.5262 B2BUA          56 : 2 x [statistics.c:
> build_stat_name, line 122]
> 2017-07-21T18:44:57.5263 B2BUA         264 : 33 x [mi/mi.c: register_mi_cmd,
> line 174]
> 2017-07-21T18:44:57.5264 B2BUA         616 : 5 x [timer.c: new_os_timer,
> line 145]
> 2017-07-21T18:44:57.5265 B2BUA          64 : 1 x [statistics.c:
> register_tcp_load_stat, line 179]
> 2017-07-21T18:44:57.5266 B2BUA          32 : 1 x [map.c: map_create, line
> 79]
> 2017-07-21T18:44:57.5266 B2BUA         864 : 1 x [core_stats.c:
> init_pkg_stats, line 173]
> 2017-07-21T18:44:57.5267 B2BUA           8 : 1 x [timer.c: init_timer, line
> 82]
> 2017-07-21T18:44:57.5268 B2BUA           8 : 1 x [usr_avp.c:
> init_extra_avps, line 83]
> 2017-07-21T18:44:57.5269 B2BUA          24 : 1 x [ds_fixups.c:
> fixup_partition_sets_null, line 386]
> 2017-07-21T18:44:57.5270 B2BUA          40 : 5 x [evi/event_interface.c:
> evi_publish_event, line 75]
> 2017-07-21T18:44:57.5271 B2BUA           8 : 1 x [statistics.c:
> register_tcp_load_stat, line 186]
> 2017-07-21T18:44:57.5271 B2BUA           8 : 1 x [usr_avp.c:
> init_extra_avps, line 74]
> 2017-07-21T18:44:57.5272 B2BUA         144 : 1 x [core_stats.c:
> init_pkg_stats, line 174]
> 2017-07-21T18:44:57.5274 B2BUA         400 : 1 x [evi/event_interface.c:
> evi_publish_event, line 61]
> 2017-07-21T18:44:57.5275 B2BUA           8 : 1 x [mem/shm_mem.c:
> shm_mem_init_mallocs, line 387]
> 2017-07-21T18:44:57.5275 B2BUA           8 : 1 x [dispatch.c: init_ds_data,
> line 98]
> 2017-07-21T18:44:57.5276 B2BUA           8 : 1 x [daemonize.c:
> create_status_pipe, line 90]
> 2017-07-21T18:44:57.5277 B2BUA  dumping free list stats :
> 2017-07-21T18:44:57.5278 B2BUA hash=  12. fragments no.:     1, unused:
> 0#012#011#011 bucket size:        96 -        96 (first        96)
> 2017-07-21T18:44:57.5278 B2BUA hash=  15. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       120 -       120 (first       120)
> 2017-07-21T18:44:57.5279 B2BUA hash=  37. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       296 -       296 (first       296)
> 2017-07-21T18:44:57.5280 B2BUA hash=  50. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       400 -       400 (first       400)
> 2017-07-21T18:44:57.5281 B2BUA hash=  69. fragments no.:     1, unused:
> 0#012#011#011 bucket size:       552 -       552 (first       552)
> 2017-07-21T18:44:57.5281 B2BUA hash= 378. fragments no.:     1, unused:
> 0#012#011#011 bucket size:      3024 -      3024 (first      3024)
> 2017-07-21T18:44:57.5282 B2BUA hash= 434. fragments no.:     1, unused:
> 0#012#011#011 bucket size:      3472 -      3472 (first      3472)
> 2017-07-21T18:44:57.5283 B2BUA hash= 498. fragments no.:     1, unused:
> 0#012#011#011 bucket size:      3984 -      3984 (first      3984)
> 2017-07-21T18:44:57.5284 B2BUA hash= 715. fragments no.:     1, unused:
> 0#012#011#011 bucket size:      5720 -      5720 (first      5720)
> 2017-07-21T18:44:57.5284 B2BUA hash= 2049. fragments no.:     1, unused:
> 0#012#011#011 bucket size:     16384 -     32768 (first     30672)
> 2017-07-21T18:44:57.5285 B2BUA hash= 2051. fragments no.:     1, unused:
> 0#012#011#011 bucket size:     65536 -    131072 (first    101152)
> 2017-07-21T18:44:57.5286 B2BUA hash= 2054. fragments no.:     1, unused:
> 0#012#011#011 bucket size:    524288 -   1048576 (first    539096)
> 2017-07-21T18:44:57.5287 B2BUA hash= 2056. fragments no.:     1, unused:
> 0#012#011#011 bucket size:   2097152 -   4194304 (first   2622816)
> 2017-07-21T18:44:57.5287 B2BUA hash= 2059. fragments no.:     1, unused:
> 0#012#011#011 bucket size:  16777216 -  33554432 (first  29997120)
> 2017-07-21T18:44:57.5288 B2BUA -----------------------------
> 2017-07-21T18:44:57.5289 B2BUA DBG:core:shm_mem_destroy: destroying the
> shared memory lock
> ^C
> [root at new-centos7 sbin]#
>
>
> Sorry for bad english =)
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Does-not-release-shared-memory-tp7608065.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list