Fix: relayd: live: crash on attach to a session without trace chunk
[lttng-tools.git] / src / bin / lttng-relayd / live.c
index 8c4f501aa3446afd5b5cb5d7e72e42bf82dd2d11..e480f86e483400874c2240b78dfe74b46524222f 100644 (file)
@@ -1080,6 +1080,15 @@ int viewer_attach_session(struct relay_connection *conn)
        DBG("Attach session ID %" PRIu64 " received", session_id);
 
        pthread_mutex_lock(&session->lock);
+       if (!session->current_trace_chunk) {
+               /*
+                * Session is either being destroyed or it never had a trace
+                * chunk created against it.
+                */
+               DBG("Session requested by live client has no current trace chunk, returning unknown session");
+               response.status = htobe32(LTTNG_VIEWER_ATTACH_UNK);
+               goto send_reply;
+       }
        if (session->live_timer == 0) {
                DBG("Not live session");
                response.status = htobe32(LTTNG_VIEWER_ATTACH_NOT_LIVE);
This page took 0.023088 seconds and 4 git commands to generate.