Issue
=====
While tracking a bug in the LTTng Consumer daemon we witness an
assertion failure of Babeltrace:
# Test ust streaming live clear with viewer
# Parameters: tracing_active=1, clear_twice=1, buffer_type=uid
ok 253 - Create session Yi7ksFEZ76dwwd4m with uri:net://localhost and opts: --live
ok 254 - Enable channel chan for session Yi7ksFEZ76dwwd4m
ok 255 - Enable ust event tp:tptest for session Yi7ksFEZ76dwwd4m
ok 256 - Start tracing for session Yi7ksFEZ76dwwd4m
# Waiting for live trace at url: net://localhost
ok 257 - Waiting for live trace at url: net://localhost
# Waiting for live viewers on url: net://localhost
ok 258 - Waiting for live viewers on url: net://localhost
07-10 15:14:20.932 13745 13745 E PLUGIN/SRC.CTF.LTTNG-LIVE/VIEWER lttng_live_get_stream_bytes@viewer-connection.c:1601 [lttng-live] Received get_data_packet response: unknown
(╯°□°)╯︵ ┻━┻ msg-iter.c:491: request_medium_bytes(): Assertion `buffer_sz != 0` failed
The issue is that even when the `lttng_live_get_stream_bytes()`
function fails miserably because of an unknown status code, it could
return a `CTF_MSG_ITER_MEDIUM_STATUS_OK`. This happens because we are
calling the `viewer_status_to_ctf_msg_iter_medium_status()` function in
the `error:` label even when the `status` variable was already set.
Solution
========
Add another label to specifically convert status from `enum lttng_live_viewer_status` to
`enum ctf_msg_iter_medium_status`.
Notes
=====
- This commit adds the printing of the value of the unknown status
received by the Relay
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I6c740dd28ee0b336cf06dbdbf60d6333cf79d168
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3758
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
if (viewer_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
viewer_handle_send_status(self_comp, NULL,
viewer_status, "get data packet command");
if (viewer_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
viewer_handle_send_status(self_comp, NULL,
viewer_status, "get data packet command");
+ goto error_convert_status;
}
viewer_status = lttng_live_recv(viewer_connection, &rp, sizeof(rp));
if (viewer_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
viewer_handle_recv_status(self_comp, NULL,
viewer_status, "get data packet reply");
}
viewer_status = lttng_live_recv(viewer_connection, &rp, sizeof(rp));
if (viewer_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
viewer_handle_recv_status(self_comp, NULL,
viewer_status, "get data packet reply");
+ goto error_convert_status;
}
flags = be32toh(rp.flags);
}
flags = be32toh(rp.flags);
goto end;
default:
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
goto end;
default:
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
- "Received get_data_packet response: unknown");
+ "Received get_data_packet response: unknown (%d)", rp_status);
status = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
status = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
}
if (req_len == 0) {
status = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
}
if (req_len == 0) {
status = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
}
viewer_status = lttng_live_recv(viewer_connection, buf, req_len);
if (viewer_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
viewer_handle_recv_status(self_comp, NULL,
viewer_status, "get data packet");
}
viewer_status = lttng_live_recv(viewer_connection, buf, req_len);
if (viewer_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
viewer_handle_recv_status(self_comp, NULL,
viewer_status, "get data packet");
+ goto error_convert_status;
}
*recv_len = req_len;
status = CTF_MSG_ITER_MEDIUM_STATUS_OK;
goto end;
}
*recv_len = req_len;
status = CTF_MSG_ITER_MEDIUM_STATUS_OK;
goto end;
status = viewer_status_to_ctf_msg_iter_medium_status(viewer_status);
end:
return status;
status = viewer_status_to_ctf_msg_iter_medium_status(viewer_status);
end:
return status;