Skip to content

[USDT] Lttng tracing improvements. #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GlenTiki opened this issue Oct 16, 2015 · 6 comments
Closed

[USDT] Lttng tracing improvements. #34

GlenTiki opened this issue Oct 16, 2015 · 6 comments

Comments

@GlenTiki
Copy link

Hey guys,

So, first off, I'm doing some work on the lttng tracepoints in core. I'm willing to take some suggestions of where to place some tracepoints to get valuable information out. :)

Also I'm seeing a problem with the placement with an existing tracepoint, and I'm wondering can I get some help/guidance on how to deal with it.

So, what we have is a bunch of LTTNG_TRACEPOINTS defined here: https://github.com/nodejs/node/blob/master/src/node_lttng.cc
The issue I'm working on is that when LTTNG_NET_SERVER_CONNECTION is called, there is a valid args._handle object defined, which gives us an fd for the incoming connection. Then, when that connection is ended, LTTNG_NET_STREAM_END is called. But the issue here is that when that is called, the args._handle has been set to null, so you can't connect to two connections based upon the fd the socket worked with.

I have done some digging, and this is what I found. LTTNG_NET_SERVER_CONNECTION is called here: https://github.com/nodejs/node/blob/master/lib/net.js#L1428
This is after the socket is instantiated and the socket._handle is set.
LTTNG_NET_STREAM_END is called here: https://github.com/nodejs/node/blob/master/lib/net.js#L403 but at this stage, I'm seeing the socket._handle is set to null so we lose the fd, and the tracepoint sets it to one. socket._handle has been set to null here: https://github.com/nodejs/node/blob/master/lib/net.js#L472

So, I guess that this was a choice of core as to how they destroy sockets, but that means the output of LTTNG_NET_STREAM_END is kinda meaningless, because the fd is set to -1 and I cant connect the server connection to the stream end. Should I create a different tracepoint for in socket._destroy to get the fd when the socket is destroyed? or (unlikely) should I look at working on that net code?

@Qard
Copy link
Member

Qard commented Oct 16, 2015

That seems like a bug, in my opinion. The socket.end(...) function, where those end hooks have been placed, is only called by socket.destroySoon(...), which is not the only path for a socket to "end".

@GlenTiki
Copy link
Author

So, how should it be handled? I don't know how to proceed about it, tbh :)

@Qard
Copy link
Member

Qard commented Oct 18, 2015

I'm not too sure either.

@trevnorris @piscisaureus @bnoordhuis Thoughts?

@trevnorris
Copy link

Reason we manually set _handle = null is because internally we run the destructor on the TCPWrap class. This would make the ._handle reference an empty object and any attempts to access it would cause your program to crash.

Are you simply attempting to trace back the close event to the connection event?

@Qard
Copy link
Member

Qard commented Oct 19, 2015

Yeah, it seems like using the fd to identify linkage would work in most cases, but not here.

@GlenTiki
Copy link
Author

yeah, I am.

@AndreasMadsen AndreasMadsen changed the title Lttng tracing improvements. [USTT] Lttng tracing improvements. Sep 22, 2017
@AndreasMadsen AndreasMadsen changed the title [USTT] Lttng tracing improvements. [USDT] Lttng tracing improvements. Sep 22, 2017
@GlenTiki GlenTiki closed this as completed Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants