Fix: relayd: connection abruptly closed on viewer stream creation failure
[lttng-tools.git] / src / bin / lttng-relayd / live.cpp
index 5925642f09837ce7a421c095a3992abc1fc82424..e0d446b2a1a4ee25cdc25539c870a87f52a1ef91 100644 (file)
@@ -1266,7 +1266,12 @@ int viewer_get_new_streams(struct relay_connection *conn)
                        LTTNG_VIEWER_SEEK_BEGINNING, &nb_total, &nb_unsent,
                        &nb_created, &closed);
        if (ret < 0) {
-               goto error_unlock_session;
+               /*
+                * This is caused by an internal error; propagate the negative
+                * 'ret' to close the connection.
+                */
+               response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_ERR);
+               goto send_reply;
        }
        send_streams = 1;
        response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_OK);
@@ -1321,10 +1326,6 @@ end_put_session:
        }
 error:
        return ret;
-error_unlock_session:
-       pthread_mutex_unlock(&session->lock);
-       session_put(session);
-       return ret;
 }
 
 /*
This page took 0.023821 seconds and 4 git commands to generate.