[lttng-dev] Printing to stdout and stderr from the userspace library.

Glen Keane glenkeane.94 at gmail.com
Wed Feb 4 18:05:42 EST 2015


Wow, thanks for quickly dealing with this issue!

Glen.

On Wed, Feb 4, 2015 at 10:46 PM, Mathieu Desnoyers <
mathieu.desnoyers at efficios.com> wrote:

> ------------------------------
>
> *From: *"Mathieu Desnoyers" <mathieu.desnoyers at efficios.com>
> *To: *"Glen Keane" <glenkeane.94 at gmail.com>
> *Cc: *lttng-dev at lists.lttng.org
> *Sent: *Wednesday, February 4, 2015 12:11:39 PM
> *Subject: *Re: [lttng-dev] Printing to stdout and stderr from
> the        userspace        library.
>
>
> ------------------------------
>
> *From: *"Glen Keane" <glenkeane.94 at gmail.com>
> *To: *lttng-dev at lists.lttng.org
> *Sent: *Wednesday, February 4, 2015 10:13:06 AM
> *Subject: *[lttng-dev] Printing to stdout and stderr from the
> userspace        library.
>
> Hey Everybody,
>
> I'm currently working on getting Lttng tracepoints into node.js/iojs. iojs
> is a downstream fork of node.js, which I personally hope will be merged
> back into node.js, which will then include all my tracing work from iojs.
> I'm currently having some trouble with lttng userspace library printing to
> stdout/stderr from iojs however.
>
> I currently have a pull request issued on the iojs core (
> https://github.com/iojs/io.js/pull/702) and this could hopefully mean we
> will get lttng tracepoints into the project! :)
>
> I have hit an issue with my pull request, however. If you follow the link
> above you can see @bnoordhuis asked me about a test which I had to modify
> for this pull request. This particular test passes some variables to a
> child process, the child prints the variables to stdout/stderr, and the
> parent takes a pipe of the childs stdout/stderr and compares it to an
> expected stdout/stderr, and asserts they match. If they don't match, its a
> catastrophic failure and that single test fails.
>
> The issue here is that when you spawn a child process in node.js and pass
> it a custom ENV variable, the ENV variables available to the child process
> will not have access to any of the ENV variables of the parent process.
> This means there is no LTTNG_HOME or HOME env variables available to the
> child process. This then in turn means that when lttng's userspace library
> is instantiated it doesn't have access to either of those variables and
> spits out this warning to stderr:
>
> Warning: HOME environment variable not set. Disabling LTTng-UST per-user
> tracing.
>
> I accept this warning is warranted, as there is no tracing location
> available to the child process so therefore it cannot be traced, but it
> means that the test fails, as it does not expect this error to printed to
> stderr. I am looking for a way to silence the output of the library so this
> test doesn't need to be modified, and so I don't have to implicitly pass a
> child process the ENV HOME variable or LTTNG-HOME variable. The ability to
> clear all env variables being passed to a child is a design choice which is
> acceptable behaviour of io.js.
>
> I did not expect a library to print to stderr/stdout however, and I feel
> that this is something that may need to approached and rectified.
>
>
> It makes sense to move the output of this library somewhere else than the
> console, but where,
> and how could we override the behavior without adding an environment
> variable, which seems
> to be impossible to use in your use-case ?
>
> Issue taken care of in lttng-ust master by only showing the lttng-ust
> library
> error output when either:
>
> LTTNG_UST_DEBUG env. var. is set, or LTTNG_UST_DEBUG
> is defined at library compile-time.
>
> See the following commits:
>
> commit d14c063ab40215ec3c99e7b68483a5e170121a09
> Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> Date:   Wed Feb 4 17:41:32 2015 -0500
>
>     Update manpage about LTTNG_UST_DEBUG effect
>
>     Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>
> commit 7bdd21a41092a59207958911666cbd458f93a319
> Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> Date:   Wed Feb 4 17:39:01 2015 -0500
>
>     Don't output to stderr from lib unless DEBUG is activated
>
>     Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>
> commit eb2b066ff35dcafa727fae7e8853a9750233063e
> Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> Date:   Wed Feb 4 17:33:59 2015 -0500
>
>     Remove usterr.h, use usterr-signal-safe.h everywhere instead
>
>     Remove minimally used code.
>
>     Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>
> Since this is a behavior change, it stay in master until the
> next LTTng release cycle (2.7).
>
> Feedback is welcome,
>
> Thanks!
>
> Mathieu
>
>
>
> Thoughts ?
>
> Thanks,
>
> Mathieu
>
>
> Thanks for reading,
> Glen Keane.
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150204/e4195045/attachment-0001.html>


More information about the lttng-dev mailing list