Project

General

Profile

Feature #705

Resolve .lttngrc contention issues

Added by Daniel U. Thibault over 6 years ago. Updated almost 6 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
-
Target version:
Start date:
12/12/2013
Due date:
% Done:

0%

Estimated time:

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.

#1

Updated by David Goulet about 6 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.

#2

Updated by Daniel U. Thibault about 6 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.

#3

Updated by Mathieu Desnoyers about 6 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.

#4

Updated by Mathieu Desnoyers about 6 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.

#5

Updated by Mathieu Desnoyers about 6 years ago

  • Status changed from New to Confirmed

putting back the "confirmed" state.

#6

Updated by Daniel U. Thibault about 6 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.

#7

Updated by Christian Babeux almost 6 years ago

  • Status changed from Confirmed to Invalid
#8

Updated by Daniel U. Thibault almost 6 years ago

Please explain the 'invalid' rating. Are you claiming the various contention scenarios outlined before do not occur?

Also available in: Atom PDF