-
Notifications
You must be signed in to change notification settings - Fork 15
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
"Unrooted" backtraces #19
Comments
I have also verified (by |
CC @vtjnash, @ViralBShah, @JeffBezanson, @StefanKarpinski. This issue is nowhere near as serious as #14 (which is OSX-specific) and #16 (which Jameson seems to have fixed, once it gets applied to master), but it's worth knowing about in terms of planning for I've verified that this issue is unchanged by changing our
to
(although the latter seems technically more correct, so perhaps we should anyway). I've glanced at the code for |
In trying to fix #14, I have made exactly the change Tim suggests to |
I have a hunch now that this isn't confined just to Profile. Occasionally I've seen Has anyone else seen this phenomenon? |
I've seen something odd with the sampling profiler for some time, and finally got around to doing a little debugging. At least when run through the profiler,
rec_backtrace
sometimes return an "unrooted" backtrace. Here's a simple example file that one can use to illustrate this:If you're digging into this, one can optionally modify
profile.c
to print a little information each time a backtrace is captured:However, this isn't required if you just want to run
@sprofile
normally.Now if we say
x = linspace(0,10,10^8);
and then profiledoiceil(x)
, we find some curious observations:sprofile_get()
or via theprintf
statements in theprofile.c
patch above.ip
) correspond (vialookup
above) to(:???,:/home/tim/src/julia-modules/Profile.jl/deps/libprofile.so,0)
and(:???,:/lib/x86_64-linux-gnu/libc.so.6,0)
. The also have the same pointer address each time. These are theip
s generated from the signal (so this makes perfect sense).ip
corresponds to(:unsafe_iceil,:/tmp/unrooted.jl,5)
. That itself is very sensible. What's weird is that it claims not to be being called bydoiceil
(it is "unrooted")---it's as ifunsafe_iceil
is sitting at the head of the stack.ip
corresponds to something perfectly-sensible like(:unsafe_iceil,:/tmp/unrooted.jl,5)
. In such cases the pointer is in the same general memory region as for backtraces of length 3 that end up with the same lookup result.(:???,:???,0)
for the thirdip
. In such cases the pointer is relatively far away from locations that are typical of the sensible ones (examples:0x7f70a7487a20
for the nonsensical one, whereasunsafe_iceil
had one at0x7f70a49f24c0
anddoiceil
had one at0x7f70a49f2470
). "Good" pointers have many different values, whereas it seems that any time the third pointer was not in the0x7f70a49f
region, it was always at this same0x7f70a7487a20
. However, theip
s after this weird third one seem fine.The full sprofile_tree report looks like this:
Assuming we ignore the pointer value and just consider its lookup, there are 7 types of backtraces represented here:
unsafe_iceil
seem as if they should be of length 20, not 19, and descend fromdoiceil
. However, I've checked and there really are only 2 distinct lengths to the backtraces. (Or, perhaps this represents inlining, and the backtrace behavior has changed relative to earlier versions of julia.)???
one, on the last line, are the length-19 backtraces with weird 3rd pointer.At least for this example, the proportion of unrooted backtraces is disturbingly large.
The text was updated successfully, but these errors were encountered: