Track the issues discovered by different developers while implementing in-memory only presentity records for presence module.
A report and discussions were done at:
* https://github.com/kamailio/kamailio/commit/f917318c1e5fefa4106eaaf46123506d...
segfault when `modparam("presence", "subs_db_mode", 0)`
``` (gdb) (gdb) bt full #0 0x00007f12607da547 in atomic_cmpxchg_int (var=0x8, old=0, new_v=1) at ../../core/mem/../atomic/atomic_x86.h:224 ret = 32530 #1 0x00007f12607da57b in futex_get (lock=0x8) at ../../core/mem/../futexlock.h:99 v = 21864 i = 1024 #2 0x00007f12607fe0d0 in update_db_subs_timer_dbnone (no_lock=0) at subscribe.c:2079 i = 0 now = 1587487071 s = 0x0 prev_s = 0x0 del_s = 0x5568ae3160b0 __func__ = "update_db_subs_timer_dbnone" #3 0x00007f1260802121 in timer_db_update (ticks=61825161, param=0x0) at subscribe.c:2441 no_lock = 0 __func__ = "timer_db_update" #4 0x00005568ade05b2e in sr_wtimer_exec (ticks=61825161, param=0x0) at core/timer_proc.c:433 wt = 0x7f126821dae8 wn = 0x0 wp = 0x0 cs = 4 __func__ = "sr_wtimer_exec" #5 0x00005568ade04b58 in fork_sync_timer (child_id=-1, desc=0x5568ae01a3a1 "secondary timer", make_sock=1, f=0x5568ade057a8 <sr_wtimer_exec>, param=0x0, interval=1000) at core/timer_proc.c:267 pid = 0 ts1 = 989202582 ts2 = 1000 #6 0x00005568ade05ece in sr_wtimer_start () at core/timer_proc.c:459 __func__ = "sr_wtimer_start" #7 0x00005568adc05e24 in main_loop () at main.c:1452 i = 21864 pid = 6405 si = 0x0 si_desc = "H4\037h\022\177\000\000\b\201\026h\022\177\000\000\000\000\200\000\003\000\000\000`.\022h\022\177", '\000' <repeats 13 times>, "\004\000\000\000\000H9\037h\022\177\000\000\323u\000\256hU\000\000\200\243\001\225\375\177\000\000\207ыh\022\177\000\000`\243\001\225\375\177\000\000 \000\000\000\060\000\000\000p\243\001\225\375\177\000\000\260\242\001\225\375\177\000\000\323u\000\256hU\000\000Pw\037h\022\177\000" nrprocs = 0 woneinit = 21864 __func__ = "main_loop" #8 0x00005568adc123e7 in main (argc=9, argv=0x7ffd9501a8a8) at main.c:2845 cfg_stream = 0x5568b01ad010 c = -1 r = 0 ---Type <return> to continue, or q <return> to quit--- tmp = 0x7f126976e708 "" tmp_len = 0 port = 0 proto = 32765 ahost = 0x0 aport = 0 options = 0x5568adfd3918 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:" ret = -1 seed = 4119354055 rfd = 4 debug_save = 4 debug_flag = 1 dont_fork_cnt = 1 n_lst = 0x7f126976d948 <_rtld_global+2312> p = 0x7f1268907010 <handle_intel+144> "H\205\300uTD9t$\fA\215V\001v0A\211ָ\002" st = {st_dev = 18, st_ino = 63494, st_nlink = 2, st_mode = 16832, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1587484687, tv_nsec = 26720353}, st_mtim = { tv_sec = 1587486933, tv_nsec = 570847206}, st_ctim = {tv_sec = 1587486933, tv_nsec = 570847206}, __glibc_reserved = {0, 0, 0}} tbuf = "\330\331vi\022\177\000\000\220Q\342h\022\177\000\000H\331vi\022\177\000\000\370\250\001\225\375\177\000\000p\341vi\022\177\000\000\000\000\000\000\000\000\000\000@\320vi\022\177\000\000\224{Ui\022\177\000\000\001", '\000' <repeats 15 times>, "\350\244\001\225\375\177\000\000\360,\207h\022\177\000\000 \247\001\225\375\177\000\000\332\361Ui\022\177\000\000\300@\301h\022\177\000\000\327\352\224h\022\177\000\000\240K\342h\022\177\000\000\200\071\301h\022\177\000\000(\224\342h\022\177\000\000\000\020", '\000' <repeats 14 times>, "\310\344vi\022\177\000\000\000\000\000\000\000\000\000\000ؗTi\022\177\000\000\220\223Ti\022\177\000\000\200"... option_index = 0 long_options = {{name = 0x5568adfd5916 "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x5568adfd10e9 "version", has_arg = 0, flag = 0x0, val = 118}, {name = 0x5568adfd591b "alias", has_arg = 1, flag = 0x0, val = 1024}, { name = 0x5568adfd5921 "subst", has_arg = 1, flag = 0x0, val = 1025}, {name = 0x5568adfd5927 "substdef", has_arg = 1, flag = 0x0, val = 1026}, {name = 0x5568adfd5930 "substdefs", has_arg = 1, flag = 0x0, val = 1027}, { name = 0x5568adfd593a "server-id", has_arg = 1, flag = 0x0, val = 1028}, {name = 0x5568adfd5944 "loadmodule", has_arg = 1, flag = 0x0, val = 1029}, {name = 0x5568adfd594f "modparam", has_arg = 1, flag = 0x0, val = 1030}, { name = 0x5568adfd5958 "log-engine", has_arg = 1, flag = 0x0, val = 1031}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}} __func__ = "main" (gdb)
Can you get the output for following commands:
``` frame 2 p subs_htable p subs_htable[0] p shtable_size ```
``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f12607da547 in atomic_cmpxchg_int (var=0x8, old=0, new_v=1) at ../../core/mem/../atomic/atomic_x86.h:224 224 ATOMIC_FUNC_CMPXCHG(cmpxchg, "cmpxchgl %2, %1", int , int) (gdb) frame 2 #2 0x00007f12607fe0d0 in update_db_subs_timer_dbnone (no_lock=0) at subscribe.c:2079 2079 lock_get(&subs_htable[i].lock); (gdb) p subs_htable $1 = (shtable_t) 0x0 (gdb) p subs_htable[0] Cannot access memory at address 0x0 (gdb) p shtable_size $2 = 9 (gdb) ```
Apparently I broke initialization of some structures when I added conditions on db connectivity. I just pushed another set of commits in master. Can you try again?
trying again on latest master branch. i'll post results.
more coredumps. is it okay to email the bt to you as they may contain sensitive data at this point?
Yes, send them to me.
I am at the stage of testing with default config file that still uses database for subscriptions and watchers, but with presentity records kept in memory. Tests are ok so far with two devices watching each other the presence status.
Closing based on a few days running without issues. From now on newly discovered bugs can get a dedicated issue on this tracker.
Closed #2294.