Feature #853
closedLive session is listed by relayd after the session has been destroyed
100%
Description
I have a viewer (not babeltrace) connected to relayd using the live protocol and attached to a live session. The session is started then destroyed. Then I list the sessions again using the same viewer (LTTNG_VIEWER_LIST_SESSIONS) and it returns the destroyed session. If I try to attach to it, it returns a status LTTNG_VIEWER_ATTACH_ALREADY. I think this session should not be listed or there should be a status that indicates that the session doesn't exist anymore.
Files
Updated by Marc-Andre Laperle about 10 years ago
- File relayd-log.txt relayd-log.txt added
If forgot to mention that I am using lttng-tools 2.5.1
You will find attached the verbose logging of relayd.
Updated by Julien Desfossez about 10 years ago
I have also already seen this behavior sometimes when playing with instable viewers, but I can't find a reliable way to reproduce it.
I tried killing babeltrace at various stages of the process but still no luck.
Do you have a reliable way to reproduce the problem that I could try ?
In the mean time, I'm investigating the various teardown paths.
Updated by Julien Desfossez about 10 years ago
- Status changed from New to Confirmed
Updated by Julien Desfossez about 10 years ago
- Status changed from Confirmed to Feedback
If you know at least at which stage the viewer is (getting indexes, metadata, streams, data, etc), that would help.
Because from what I see in the log, the viewer is still there: no error or disconnect. Are you sure this log contains the problem ?
Updated by Marc-Andre Laperle about 10 years ago
Julien Desfossez wrote:
I have also already seen this behavior sometimes when playing with instable viewers, but I can't find a reliable way to reproduce it.
I tried killing babeltrace at various stages of the process but still no luck.
I'm not sure you could reproduce this with babeltrace since it doesn't stay connected to relayd when the lttng session is destroyed.
Do you have a reliable way to reproduce the problem that I could try ?
Maybe I can try to modify live_test.c to demonstrate the problem. Of if you have the Eclipse setup, I can update my code a bit to make it shareable.
If you know at least at which stage the viewer is (getting indexes, metadata, streams, data, etc), that would help.
I'm not sure which state that would be... I guess "listing sessions"? Sorry, that I'm not very clear. It's the same viewer session all along. The first lttng session that was destroyed is still listed on a subsequent LTTNG_VIEWER_LIST_SESSIONS.
So basically:
1. create a live session (lttng create --live, etc)
2. Connect to relayd with a viewer, list the sessions, attach to the session...
3. Destroy the lttng session
4. Without the viewer disconnecting (so using the same viewer session), list the sessions again: the destroyed session is still listed, that would help.
Because from what I see in the log, the viewer is still there: no error or disconnect. Are you sure this log contains the problem ?
Yes the viewer should still be there, it's the same viewer session all along. The problem is that it's listing the destroyed lttng session again. I don't think there's much to see in the log about that unfortunately :(
Updated by Julien Desfossez about 10 years ago
- File 0002-test-live-detach.patch 0002-test-live-detach.patch added
- File 0001-Test-implement-a-command-to-detach-a-viewer-session.patch 0001-Test-implement-a-command-to-detach-a-viewer-session.patch added
Thanks for the clarification.
This is actually the normal behavior: the session is kept alive on the relay's viewer side until there is no viewer attached to it.
As soon as the viewer exits, the session is destroyed on the relay.
For Babeltrace, it makes sense to close the connection and exit when the session has been read entirely, but I understand that for TraceCompass, it would make more sense to keep the same network connection alive to attach to other sessions especially since we already allow a viewer to attach to multiple sessions at the same time.
Attached to this message is a patch to implement a detach command and a quick test. The viewer can call it when it is attached to a session and it will release it from the relayd.
Can you test it and tell me if that would be an appropriate solution for your use-case ?
Since this is a feature, it won't get in before the 2.7 merge window, but that shouldn't be too far.
Updated by Marc-Andre Laperle about 10 years ago
Thanks Julien, that sounds great. I hadn't planned to work on live in the next few days but I'll try to squeeze this in and get back to you quickly.
Updated by Marc-Andre Laperle almost 10 years ago
Julien Desfossez wrote:
Attached to this message is a patch to implement a detach command and a quick test. The viewer can call it when it is attached to a session and it will release it from the relayd.
Can you test it and tell me if that would be an appropriate solution for your use-case ?
Hi Julien. I just tried the patch. This is very helpful! I can successfuly detach and attach again using the same view session, etc. So from my perspective, it is a good solution. Thanks again!
Updated by Julien Desfossez almost 10 years ago
- Tracker changed from Bug to Feature
- Status changed from Feedback to Confirmed
Great !
So I'm moving this bug to a feature request and will send the patches as soon as we enter the 2.7 development cycle.
Thanks,
Julien
Updated by Jérémie Galarneau over 9 years ago
http://lists.lttng.org/pipermail/lttng-dev/2015-June/024577.html
Will you be submitting a v2?
Updated by Julien Desfossez over 9 years ago
Oups, I had completely forgotten about this one.
Is it too late for this cycle (since we are in RC) ?
If it's not, I can submit the v2 this week.
Julien
Updated by Marc-Andre Laperle about 9 years ago
I just want to let you know that it would still be a nice feature ;)
Updated by Jérémie Galarneau about 9 years ago
There were a lot of fixes to the relayd during the 2.7 RC cycle so we'll have to rework the patches for 2.8.
Updated by Julien Desfossez over 8 years ago
- Status changed from Confirmed to Resolved
- % Done changed from 0 to 100
Applied in changeset tools|commit:d62023be5fccac24ad404aff2915c1888c22755c.
Updated by Marc-Andre Laperle over 8 years ago
I can confirm that this works in LTTng Tools 2.8. With a viewer attached to a session, I can issue a VIEWER_DETACH_SESSION command, then VIEWER_LIST_SESSIONS does not contain the old session anymore. Thanks for this!