Feature #705
closed
Resolve .lttngrc contention issues
Added by Daniel U. Thibault about 11 years ago.
Updated over 10 years ago.
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).
The behaviour would be:
- If the
lttng
client is elevated (through an su
shell or a sudo
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
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.
- 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.
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.
- 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.
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.
- Status changed from New to Confirmed
putting back the "confirmed" state.
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.
- Status changed from Confirmed to Invalid
Please explain the 'invalid' rating. Are you claiming the various contention scenarios outlined before do not occur?
Also available in: Atom
PDF