Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usrloc_dmq: add module for usrloc sync via dmq #3

Merged
merged 4 commits into from
Jan 3, 2015

Conversation

AndreyRybkin
Copy link

New module for synchronizing usrloc contacts via dmq.

@miconda
Copy link
Member

miconda commented Nov 24, 2014

I will look over it and if all ok, I will integrate in short time.

@linuxmaniac linuxmaniac changed the title Add module for usrloc sync via dmq usrloc_dmq: add module for usrloc sync via dmq Dec 9, 2014
@miconda
Copy link
Member

miconda commented Dec 10, 2014

Just short update that we are going to use github as main git repository starting with next week, making easier to review and accept this patch here, rather than do it it manually to git.sip-router.org.

@miconda
Copy link
Member

miconda commented Jan 3, 2015

I will merge this. There are few things to be sorted out in short term:

  • variables to be declared at the beginning of functions or blocks, to be sure it still compiles with old strict C compilers
  • add license at the top of the c/h files - it must be GPLv2 or BSD, at your choice

We will grant you direct commit access to main kamailio repository, so you can push those updates directly.

miconda added a commit that referenced this pull request Jan 3, 2015
usrloc_dmq: add module for usrloc sync via dmq
@miconda miconda merged commit 2f1c30a into kamailio:master Jan 3, 2015
@WhoSunilMore WhoSunilMore mentioned this pull request May 13, 2016
guillemj added a commit to guillemj/kamailio that referenced this pull request Nov 14, 2019
The code enabled by SIG_DEBUG inside signal handlers is
async-signal-unsafe (see the signal-safetey(7) man page), as it calls
at least syslog(3) and stdio functions.

During a daemon shutdown via a SIGTERM, we got a crash in isatty(3) due
to stack exhaustion from infinite nested calls within stdio coming from
the syslog(3) in src/main.c:sig_usr():

  #0  0x00007f691903fe6d in __isatty (fd=2) at ../sysdeps/posix/isatty.c:24
        term = <error reading variable term (Cannot access memory at address 0x7fffa44f4fb0)>
  kamailio#1  0x00007f6918fc37bb in local_isatty (fd=<optimized out>)
  kamailio#2  __GI__IO_file_doallocate (fp=0x7f6919110680 <_IO_2_1_stderr_>)
  kamailio#3  0x00007f6918fd1700 in __GI__IO_doallocbuf (
  kamailio#4  0x00007f6918fd0988 in _IO_new_file_overflow (
  kamailio#5  0x00007f6918fcfa8f in _IO_new_file_xsputn (n=8, data=<optimized out>,
  kamailio#6  _IO_new_file_xsputn (f=0x7f6919110680 <_IO_2_1_stderr_>,
  7  0x00007f6918fa41fb in _IO_vfprintf_internal (
  kamailio#8  0x00007f6918fc32e8 in locked_vfxprintf (
  kamailio#9  0x00007f6918fc3469 in __fxprintf (fp=0x7f6919110680 <_IO_2_1_stderr_>,
  kamailio#10 0x00007f6918fd3a50 in __malloc_assert (
  kamailio#11 0x00007f6918fd5e6f in sysmalloc (nb=nb@entry=4112,
  kamailio#12 0x00007f6918fd72c9 in _int_malloc (
  kamailio#13 0x00007f6918fd83e3 in __GI___libc_malloc (bytes=bytes@entry=4096)

  [ next calls nested until stack exhaustion ]

  #41030 0x00007f6918fc371c in __GI__IO_file_doallocate (
  #41031 0x00007f6918fd1700 in __GI__IO_doallocbuf (
  #41032 0x00007f6918fd0988 in _IO_new_file_overflow (
  #41033 0x00007f6918fcfa8f in _IO_new_file_xsputn (n=8, data=<optimized out>,
  #41034 _IO_new_file_xsputn (f=0x7f6919110680 <_IO_2_1_stderr_>,
  #41035 0x00007f6918fa41fb in _IO_vfprintf_internal (
  #41036 0x00007f6918fc32e8 in locked_vfxprintf (
  #41037 0x00007f6918fc3469 in __fxprintf (fp=0x7f6919110680 <_IO_2_1_stderr_>,
  #41038 0x00007f6918fd3a50 in __malloc_assert (
  #41039 0x00007f6918fd5e6f in sysmalloc (nb=nb@entry=4112,
  #41040 0x00007f6918fd72c9 in _int_malloc (
  #41041 0x00007f6918fd83e3 in __GI___libc_malloc (bytes=bytes@entry=4096)
  #41042 0x00007f6918fc371c in __GI__IO_file_doallocate (
  #41043 0x00007f6918fd1700 in __GI__IO_doallocbuf (
  #41044 0x00007f6918fd0988 in _IO_new_file_overflow (
  #41045 0x00007f6918fcfa8f in _IO_new_file_xsputn (n=8, data=<optimized out>,
  #41046 _IO_new_file_xsputn (f=0x7f6919110680 <_IO_2_1_stderr_>,
  #41047 0x00007f6918fa41fb in _IO_vfprintf_internal (
  #41048 0x00007f6918fc32e8 in locked_vfxprintf (
  #41049 0x00007f6918fc3469 in __fxprintf (fp=0x7f6919110680 <_IO_2_1_stderr_>,
  #41050 0x00007f6918fd3a50 in __malloc_assert (
  #41051 0x00007f6918fd5e6f in sysmalloc (nb=nb@entry=8208,
  #41052 0x00007f6918fd72c9 in _int_malloc (
  #41053 0x00007f6918fd91a2 in __libc_calloc (n=n@entry=1,
  #41054 0x00007f6918fcc0b3 in __GI___open_memstream (
  #41055 0x00007f69190477e0 in __GI___vsyslog_chk (pri=189, flag=-1,
  #41056 0x00007f6919047d4c in __syslog (pri=<optimized out>,
  #41057 0x0000563a58b01c08 in sig_usr (signo=<optimized out>) at main.c:857
  #41058 sig_usr (signo=<optimized out>) at main.c:816
  #41059 <signal handler called>

While this is certainly not easy to trigger, it's still not correct to
leave enabled in production builds. It might be an acceptable tradeoff
as a debugging aid, though.

So we switch the the code to off by default, and swap the meaning of the
macro to enable the unsafe debugging, to match.
@iliesh iliesh mentioned this pull request Oct 2, 2020
@juha-h juha-h mentioned this pull request Feb 2, 2021
mojtabaesfandiari added a commit that referenced this pull request Mar 10, 2021
Update my kamailio repository master after merging lrkproxy
sergey-safarov added a commit to sergey-safarov/kamailio that referenced this pull request Mar 20, 2022
[root@localhost]# kamcmd cfg.seti param_group param_name value

=================================================================
==2409977==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 38 byte(s) in 1 object(s) allocated from:
    #0 0xffff98c250af in malloc (/lib64/libasan.so.5+0xd50af)
    kamailio#1 0x41549f in parse_listen_id /root/kamailio/utils/kamcmd/parse_listen_id.c:133
    kamailio#2 0x4144fb in main /root/kamailio/utils/kamcmd/kamcmd.c:2075
    kamailio#3 0xffff97dc0de3 in __libc_start_main (/lib64/libc.so.6+0x20de3)
    kamailio#4 0x40260b  (/usr/local/sbin/kamcmd+0x40260b)
miconda pushed a commit that referenced this pull request Mar 22, 2022
[root@localhost]# kamcmd cfg.seti param_group param_name value

=================================================================
==2409977==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 38 byte(s) in 1 object(s) allocated from:
    #0 0xffff98c250af in malloc (/lib64/libasan.so.5+0xd50af)
    #1 0x41549f in parse_listen_id /root/kamailio/utils/kamcmd/parse_listen_id.c:133
    #2 0x4144fb in main /root/kamailio/utils/kamcmd/kamcmd.c:2075
    #3 0xffff97dc0de3 in __libc_start_main (/lib64/libc.so.6+0x20de3)
    #4 0x40260b  (/usr/local/sbin/kamcmd+0x40260b)
miconda pushed a commit that referenced this pull request May 5, 2022
[root@localhost]# kamcmd cfg.seti param_group param_name value

=================================================================
==2409977==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 38 byte(s) in 1 object(s) allocated from:
    #0 0xffff98c250af in malloc (/lib64/libasan.so.5+0xd50af)
    #1 0x41549f in parse_listen_id /root/kamailio/utils/kamcmd/parse_listen_id.c:133
    #2 0x4144fb in main /root/kamailio/utils/kamcmd/kamcmd.c:2075
    #3 0xffff97dc0de3 in __libc_start_main (/lib64/libc.so.6+0x20de3)
    #4 0x40260b  (/usr/local/sbin/kamcmd+0x40260b)

(cherry picked from commit d28ca88)
linuxmaniac added a commit that referenced this pull request Jun 22, 2022
> #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007fbb5e515537 in __GI_abort () at abort.c:79
> #2  0x00007fbb5e56e768 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fbb5e67ce2d "%s\n") at ../sysdeps/posix/libc_fatal.c:155
> #3  0x00007fbb5e575a5a in malloc_printerr (str=str@entry=0x7fbb5e67b05a "free(): invalid pointer") at malloc.c:5347
> #4  0x00007fbb5e576c14 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:4173
> #5  0x00007fbb5e5d8da0 in __GI_freeaddrinfo (ai=ai@entry=0x7fbb5e83ba10) at ../sysdeps/posix/getaddrinfo.c:2520
> #6  0x000055ba099dcd0b in log_init () at core/dprint.c:482
> #7  0x000055ba09970d7a in main (argc=10, argv=0x7ffde85a1788) at main.c:2055
linuxmaniac added a commit that referenced this pull request Jun 22, 2022
> #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007fbb5e515537 in __GI_abort () at abort.c:79
> #2  0x00007fbb5e56e768 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fbb5e67ce2d "%s\n") at ../sysdeps/posix/libc_fatal.c:155
> #3  0x00007fbb5e575a5a in malloc_printerr (str=str@entry=0x7fbb5e67b05a "free(): invalid pointer") at malloc.c:5347
> #4  0x00007fbb5e576c14 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:4173
> #5  0x00007fbb5e5d8da0 in __GI_freeaddrinfo (ai=ai@entry=0x7fbb5e83ba10) at ../sysdeps/posix/getaddrinfo.c:2520
> #6  0x000055ba099dcd0b in log_init () at core/dprint.c:482
> #7  0x000055ba09970d7a in main (argc=10, argv=0x7ffde85a1788) at main.c:2055

(cherry picked from commit 71502d2)
miconda pushed a commit that referenced this pull request Sep 15, 2022
[root@localhost]# kamcmd cfg.seti param_group param_name value

=================================================================
==2409977==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 38 byte(s) in 1 object(s) allocated from:
    #0 0xffff98c250af in malloc (/lib64/libasan.so.5+0xd50af)
    #1 0x41549f in parse_listen_id /root/kamailio/utils/kamcmd/parse_listen_id.c:133
    #2 0x4144fb in main /root/kamailio/utils/kamcmd/kamcmd.c:2075
    #3 0xffff97dc0de3 in __libc_start_main (/lib64/libc.so.6+0x20de3)
    #4 0x40260b  (/usr/local/sbin/kamcmd+0x40260b)

(cherry picked from commit d28ca88)
(cherry picked from commit 08eeb04)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants