Feature #705
closedResolve .lttngrc contention issues
0%
Description
The .lttngrc
file should be put with the other LTTng transient files like lttng-sessiond.pid
. That is to say, in /run/lttng
for a root session daemon or in $HOME/.lttng
for a user-space daemon. Doing so would avoid any .lttngrc
contention grief (such as when a non-tracing
group user alternates between sudo lttng
and lttng
commands).
The simplest way to do this is very likely to have the client obtain the .lttngrc
path from whichever session daemon it reaches (or spawns).
- If the
lttng
client is elevated (through ansu
shell or asudo
call), use/run/lttng/.lttngrc
- Else,
- If the user is a member of the
tracing
group and there is no local session daemon, use/run/lttng/.lttngrc
- Else use
$HOME/.lttng/.lttngrc
- If the user is a member of the
I say 'If the user is a member of the tracing
group and there is no local session daemon' because that is the current behaviour. For a tracing
group member, if there is no session daemon, the root daemon is spawned and becomes the client's interlocutor. If the root daemon is running and there is no local session daemon, the lttng
client again talks to the root daemon. But if there is a local session daemon (alone or in combination with a root daemon), it intercepts the (unelevated) lttng
client commands.
Updated by David Goulet almost 11 years ago
- Status changed from New to Confirmed
- Target version deleted (
2.4)
So I changed this one to Confirmed and by that I acknowledge the issue but the proposed fix is not quite right.
The .lttngrc file is meant to be per user so putting that in the run directory would make it shared across all users in the tracing group for a root session daemon. This file is for lttng UI state and not configuration thus is must stay per user.
After a discussion with other developers, it seems that writing in the user $HOME directory makes more sense. For instance:
sudo lttng create --> write in /root/.lttngrc sudo -u aUser lttng create --> write in /home/aUser/.lttngrc
The purpose of sudo is to take the rights of the user and do stuff with those creds. which by using lttng would be to write in .lttngrc of the user.
An approach with looking up the HOME directory of the user using getpwuid() seems to me more clean.
Updated by Daniel U. Thibault almost 11 years ago
David Goulet wrote:
So I changed this one to Confirmed and by that I acknowledge the issue but the proposed fix is not quite right.
The .lttngrc file is meant to be per user so putting that in the run directory would make it shared across all users in the tracing group for a root session daemon. This file is for lttng UI state and not configuration thus is must stay per user.
After a discussion with other developers, it seems that writing in the user $HOME directory makes more sense. For instance:
sudo lttng create --> write in /root/.lttngrc sudo -u aUser lttng create --> write in /home/aUser/.lttngrc
The purpose of sudo is to take the rights of the user and do stuff with those creds. which by using lttng would be to write in .lttngrc of the user.An approach with looking up the HOME directory of the user using getpwuid() seems to me more clean.
Good point about the root daemon servicing multiple users. The proposed solution does fix the problem with a non-tracing
user alternating between lttng
and sudo lttng
commands, but it does mean that multiple users issuing sudo lttng
commands will overwrite "each other's" .lttngrc
(regardless of tracing
group membership). As long as they're warned of this by the eventual updated LTTng user manual, that seems fine. It's probably not worth bending over backward to preserve separate .lttngrc
values for multiple parallel sudoers.
I would still prefer one used $HOME/.lttng/.lttngrc
rather than $HOME/.lttngrc
, just to keep the transient files together.
Updated by Mathieu Desnoyers almost 11 years ago
- Status changed from Confirmed to New
- Target version set to 2.4
make it $HOME/.lttng/lttngrc then rather than $HOME/.lttng/.lttngrc . There is no point in hiding a file in a hidden directory.
Updated by Mathieu Desnoyers almost 11 years ago
that being said, why move .lttngrc at all ?
~/.lttng/ is for the session daemon. .lttngrc is for the lttng UI. Those are two separate things.
Updated by Mathieu Desnoyers almost 11 years ago
- Status changed from New to Confirmed
putting back the "confirmed" state.
Updated by Daniel U. Thibault almost 11 years ago
Mathieu Desnoyers wrote:
that being said, why move .lttngrc at all ?
~/.lttng/ is for the session daemon. .lttngrc is for the lttng UI. Those are two separate things.
Agreed.
Updated by Christian Babeux over 10 years ago
- Status changed from Confirmed to Invalid
Updated by Daniel U. Thibault over 10 years ago
Please explain the 'invalid' rating. Are you claiming the various contention scenarios outlined before do not occur?