[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    NotifyFramePop and FramePop events
From:       JC Beyler <jcbeyler () google ! com>
Date:       2017-08-31 22:15:45
Message-ID: CAF9BGBwf6nK5gvrH1jzb5Rg1O7695+ckMzn=zaqM7xKa0xjWGA () mail ! gmail ! com
[Download RAW message or body]

Hi all,

I was asked to raise a question about NotifyFramePop and FramePop events
and I thought I would just ask it here:

If we imagine we have a stack frame such as:

call_depth0
  call_depth1
    call_depth2
       call_depth3

And at this third depth, we request a frame pop when leaving depth1 via the
NotifyFramePop call. We would of course assume that when leaving
call_depth1 we get a FramePop event.

Now imagine that we disable the frame pop event notification in call_depth2:
call_depth0
  call_depth1
    call_depth2
       SetEventNotificationMode
<https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#SetEventNotificationMode>(JVMTI_DISABLE,
JVMTI_EVENT_FRAME_POP, NULL)

If the stack now pops back to call_depth0, the frame pop system is not
checked, the FramePop for call_depth1 is not issued either.

However, imagine now that later down the road, the stack trace has built
itself back up and we enabled the event:
call_depth0
  second_call_depth1
    second_call_depth2
       SetEventNotificationMode
<https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#SetEventNotificationMode>(JVMTI_ENABLE,
JVMTI_EVENT_FRAME_POP, NULL)

Then when leaving second_call_depth1, we seemingly will issue a frame pop
event.

Here is the qualm:
  - It seems counter intuitive and the documentation does not specify/warn
about this; it seems that if you disable the events you should perhaps
clear up the pop requests.
  - At least the documentation for NotifyFramePop (
https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#NotifyFramePop)
should be changed since it says: "When the frame that is currently at depth
is popped from the stack" to something like "When the first frame at the
depth is popped from the stack and the event notification is enabled"

Therefore the questions are:

1) Is this such a corner case, that we do not wish to try to fix the
documentation or the code?
2) Is this a corner case we do not wish to handle, therefore put a fix in
the documentation to at least warn users of this
3) Is this a bug that we'd like to fix?

Thanks for your insight,
Jc

[Attachment #3 (text/html)]

<div dir="ltr">Hi all,<div><br></div><div>I was asked to raise a question about \
NotifyFramePop and FramePop events and I thought I would just ask it \
here:</div><div><br></div><div>If we imagine we have a stack frame such \
as:</div><div><br></div><div>call_depth0</div><div>   call_depth1</div><div>      \
call_depth2</div><div>           call_depth3</div><div><br></div><div>And at this \
third depth, we request a frame pop when leaving depth1 via the NotifyFramePop call. \
We would of course assume that when leaving call_depth1 we get a FramePop \
event.</div><div><br></div><div>Now imagine that we disable the frame pop event \
notification in call_depth2:</div><div><div>call_depth0</div><div>   \
call_depth1</div><div>      call_depth2</div></div><div>           <a \
href="https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#SetEventNotificationMode" \
style="font-family:monospace;font-size:medium">SetEventNotificationMode</a><span \
style="color:rgb(0,0,0);font-family:monospace;font-size:medium">(JVMTI_DISABLE, \
JVMTI_EVENT_FRAME_POP, NULL)</span><br></div><div><br></div><div>If the stack now \
pops back to call_depth0, the frame pop system is not checked, the FramePop for \
call_depth1 is not issued either.</div><div><br></div><div>However, imagine now that \
later down the road, the stack trace has built itself back up and we enabled the \
event:</div><div><div><div>call_depth0</div><div>   second_call_depth1</div><div>     \
second_call_depth2</div></div><div>           <a \
href="https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#SetEventNotificationMode" \
style="font-family:monospace;font-size:medium">SetEventNotificationMode</a><span \
style="color:rgb(0,0,0);font-family:monospace;font-size:medium">(JVMTI_ENABLE, \
JVMTI_EVENT_FRAME_POP, NULL)</span><br></div></div><div><br></div><div>Then when \
leaving second_call_depth1, we seemingly will issue a frame pop \
event.</div><div><br></div><div>Here is the qualm:</div><div>   - It seems counter \
intuitive and the documentation does not specify/warn about this; it seems that if \
you disable the events you should perhaps clear up the pop requests.</div><div>   - \
At least the documentation for NotifyFramePop (<a \
href="https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#NotifyFramePop"> \
https://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#NotifyFramePop</a>) \
should be changed since it says: &quot;When the frame that is currently at depth is \
popped from the stack&quot; to something like &quot;When the first frame at the depth \
is popped from the stack and the event notification is \
enabled&quot;</div><div><br></div><div>Therefore the questions \
are:</div><div><br></div><div>1) Is this such a corner case, that we do not wish to \
try to fix the documentation or the code?</div><div>2) Is this a corner case we do \
not wish to handle, therefore put a fix in the documentation to at least warn users \
of this</div><div>3) Is this a bug that we&#39;d like to \
fix?</div><div><br></div><div>Thanks for your insight,</div><div>Jc</div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic