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

Glen Keane glenkeane.94 at gmail.com
Wed Feb 4 10:13:06 EST 2015


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.

Thanks for reading,
Glen Keane.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150204/2a19fd32/attachment.html>


More information about the lttng-dev mailing list