Detect issue with LTTng and Docker and report error when tracing #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an issue with LTTng when using more than one Docker container that share the same mounted home directory. When trying to trace in a second container, LTTng will mistakenly think that there is a session daemon running, so it will happily trace, but no trace data will be recorded, because there isn't actually a session daemon in that container. The fix is to use a different LTTng home, e.g., by setting the
LTTNG_HOME
environment variable to a unique value. See this LTTng issue: https://bugs.lttng.org/issues/1371This PR detects this (very small) corner case and reports the issue to the user so that they can set
LTTNG_HOME
. Example:LTTNG_HOME
to a unique value (so that container 2 has its own LTTng home) and tracing again will work:Note that we must first try to spawn a session daemon is there isn't one, because, when a Docker container is killed/stopped, the
~/.lttng/lttng-sessiond.pid
file (which contains the PID of the session daemon that is expected to be running) still exists. This would result in a false positive due to the way we detect cases of the Docker issue. If we manage to spawn a session daemon before checking for an unreachable session daemon, then we avoid the false positive.Also, note that the
LTTNG_HOME
directory must exist; LTTng will not create it. Therefore, make sure to tell the user to create the directory.Signed-off-by: Christophe Bedard christophe.bedard@apex.ai