From: Mathieu Desnoyers Date: Tue, 25 Aug 2015 11:43:16 +0000 (-0400) Subject: Fix: relayd reply with error if cannot find metadata X-Git-Tag: v2.8.0-rc1~417 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=3b463131be76ea826a7e74f9b88422573e3a2076;hp=fb45065e7ccafc636e6eec7ab2a463c49e603ebb Fix: relayd reply with error if cannot find metadata Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 888ec2d4f..5d3449d4f 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -1629,7 +1629,15 @@ int viewer_get_metadata(struct relay_connection *conn) vstream = viewer_stream_get_by_id(be64toh(request.stream_id)); if (!vstream) { - reply.status = htobe32(LTTNG_VIEWER_NO_NEW_METADATA); + /* + * The metadata stream can be closed by a CLOSE command + * just before we attach. It can also be closed by + * per-pid tracing during tracing. Therefore, it is + * possible that we cannot find this viewer stream. + * Reply back to the client with an error if we cannot + * find it. + */ + reply.status = htobe32(LTTNG_VIEWER_METADATA_ERR); goto send_reply; } pthread_mutex_lock(&vstream->stream->lock);