meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.25k stars 2.48k forks source link

[1.x] Segmentation Fault in janus_log_getbuf() at log.c #3427

Closed Ajitshiva closed 4 days ago

Ajitshiva commented 2 months ago

What version of Janus is this happening on? Latest

Have you tested a more recent version of Janus too? Yes

Was this working before? This is the first time I am facing this crash for the past 2 years.

Is there a gdb or libasan trace of the issue? https://pastebin.com/BWjE7SMv

Additional context

static janus_log_buffer *janus_log_getbuf(void) {
        /*** some code  ***/
    if (b == NULL) {
        b = g_malloc(INITIAL_BUFSZ + sizeof(*b));
        // we are suspecting before b->allocated set to INITIAL_BUFSZ, b set to NULL by other thread.
        b->allocated = INITIAL_BUFSZ;
        b->next = NULL;
    }
    return b;
}

@lminiero @ramprakash110109

atoppi commented 2 months ago

The process was aborted due to a malloc failure.

1) Are you running a customized version of the server? 2) Can you provide some details about the environment (Linux distro, standard lib etc.) ? 3) Run Janus with sanitizers enabled

Ajitshiva commented 2 months ago
  1. Yes we have done very very minimal customization. But those changes should not affect the log.c malloc part.
  2. Environment is AWS instance (Debian 12 bookworm OS)
  3. I will try to Run Janus with sanitizers enabled
lminiero commented 1 month ago

@Ajitshiva we actually decided to change the way logging is performed, since it was long overdue. Please test the new PR instead.

lminiero commented 1 month ago

@Ajitshiva any feedback?

lminiero commented 4 days ago

Closing as we merged the log refactoring PR.