-
Notifications
You must be signed in to change notification settings - Fork 1.8k
KillException and QuitException handling #98
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
Conversation
|
It was intentional that KillException and QuitException was not supported for normal instruments only for language instruments. |
|
Those exceptions are required by the Debugger, which is not a language instrument and which is now broken. @chumer suggests replacing the exceptions and I agree; see new issue #109. Meanwhile, this patch is needed to keep the current debugger working correctly until a replacement is in place. I could simplify the current situation by removing any dependence on |
|
I cannot really come up with a better solution. |
|
|
||
| protected abstract void innerOnDispose(EventContext context, VirtualFrame frame); | ||
|
|
||
| final void onEnter(EventContext context, VirtualFrame frame) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CH3) onDispose should also support KillException. Any reason not to?
|
@mlvdv Please address CH1-6. |
|
CH1-2) Already suggest this possibility, so agree. MLVDV1) Is there a pattern already documented for what IOException means and how it should be used? Should it hold referred exceptions as you suggest, but why not subclassing? Is such a discussion out of scope for this PR, which is a bug fix on existing code? |
Isn't this something onReturnExceptional can and should handle? I'd rather have the logic in the handler, and the wrapper as simple as possible. |
|
+1 with @woess . Having it in the wrapper would propagate complexity to all languages. |
|
Perhaps I am missing something, but I'd actually argue the other way. If there is an exit/quit 'event', why do I need to handle that in my instrumentation? This seems to be something that should be handled by the framework/wrappers. I think, I only want language-specific events in the onReturnExceptional(). At least for my current tool, these seems to be the ones I care about. Having to handle exit/quit in tool-specific nodes also seems to ensure that the tools break, because until the recent discussions, I wasn't even aware of these exceptions. |
|
@smarr: this exception should be handled in the framework (inside ProbeNode) and not propagated to the actual instrumentation observers' onReturnExceptional methods. This way we don't duplicate the catch/rethrow (there are multiple wrapper classes (at least one per language) but only 1 ProbeNode) and effectively make it an implementation detail here. |
|
Ah, right, forgot about the |
To answer your question: yes it is out of scope of this PR. Lets discuss it here: #116 |
|
This PR address two bugs in the new instrumentation code that break the Debugger. The revisions include a fix for one of them and a request for help with another, supported by additional documentation and a test. Some of the discussion so far is inconsistent with the Debggers's requirements. Summary:
I remain open to suggestions about minor variations in implementation, especially if they relate to fast/slow path. |
|
I don't agree to 3. and 4.. It makes sense to have the option to cleanly dispose any open resources one might have opened because of a started event. How would you do that in case of a kill event?
|
The Debugger continues to be broken (9 days now) until these two fixes are in place. |
|
@mlvdv I think there's a misunderstanding here about what it means to handle KillException in ProbeNode.onReturnExceptional. Just because the WrapperNodes call this method, doesn't mean it has to generate an actual return exceptional event (i.e., notify event handlers). So all your 3 points can be addressed in this way. FWIW, the old implementation used to it this way (i.e., catch and rethrow KillException in ProbeNode.returnExceptional). I'd like to hide the existence of KillException from the guest language as much as possible. Ideally, it would be just an implementation detail of the instrumentation framework and PolyglotEngine. But at least we should avoid duplication of the catch-rethrow logic and leaking it to the guest language (which wrapper nodes are still part of, even when they're generated). It'll also give us more flexibility to do changes around it in the future. |
|
I just got an idea to use ThreadDeath for that purpose. |
|
The Javadoc of ThreadDeath says: "An application should catch instances of this class only if it must clean up after being terminated asynchronously. If ThreadDeath is caught by a method, it is important that it be rethrown so that the thread actually dies." |
No reason not to; fixed. |
@woess Can this part of the discussion be forwarded to #109 or #116? |
|
@mlvdv ok |
|
Apologies to @woess and others. My persistent misinterpretation of an earlier comment kept me from understanding the follow-up until his most recent comment caused me to look back at the code more closely. I withdraw the request for changes to auto-generation of wrappers, and I'll clean up the handling of the exceptions. |
…uired to handle KillException or QuitException specially.
… with no dependence for special handling by WrapperNodes.
* master: (41 commits) Remove JavaInteropSpeedTest. Turning checkstyle on for the 'api.vm' project Fix merge problems. Instrumentation: simple local variable rename Instrumentation: rename the two package private implementation classes of Instrumenter for clarity about their roles. Instrumentation: rename the awkwardly named (non-public) class InstrumentationInstrumenter to ClientInstrumenter (for external clients of instrumentation, as opposed to the sibling class LanguageInstrumenter). Documentation cleanup for new Instrumentation code: - Correct many Javadoc uses of obsolete class names (e.g. Instrumentation was renamed to TruffleInstrument) - Rename many variable names accordingly (e.g. "instrumentation" -> "instrument") - Avoid constructs that appear unnatural to native English speakers, e.g. "instrumentations", "instrumenters" - Rework some Javadoc explanations for clarity: more uniform terminology, diction - Fix typos No need to pre-initialize the debugger with Debugger.find, enough to call executionEvent.getDebugger Lazy initialization of debugger once somebody calls ExecutionEvent.getDebugger Make sure ExecutionEvent is always delivered BranchingNode example snippet can reference real Node class Fomatting changes Adding end of line to two files containing snippets Debug: temporary strategy for printing node tags in debugging code, simplified AST printing in debugging code Debug: update for recent changes in stack iteration Temporarily disable instrumentation tests as they seem to fail on JDK9. Fix Truffle archive merging for multiple files. use appropriate line endings when merging properties files Fix Truffle compilation issues with interop.java Ignore JavaInteropSpeedTest (should be converted into a microbenchmark). ... # Conflicts: # truffle/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/ProbeNode.java
|
KillException is still not specified in PolyglotEngine. |
KillException and QuitException handling
Agreed. |
…E.COM/truffle:feature/trufffle-profiler-upgrade to master * commit '5a9dc5d71c1abff093367681d78ed5ec9088df82': Profiler: class Javadoc Profiler: rename TruffleProfilerTest to Profiler test for name consistency Profiler: public methods now throw IllegalStateException if profiler has been disposed. Profiler: invert and rename the Instrument and Client API class, now ProfilerInstrument and Profiler respectively, other minor cleanups and fixes. TruffleProfiler: replace property-based test access with a documented, tested, client API. Allows dynamic changing of parameters specifying what is being collected, for use in interactive contexts.
[Backport][GR-60578] Upgrade ASM dependency from 9.5 to 9.7.1.
Clarify and document required behavior for WrapperNodes in the instrumentation framework. Fix a related bug in ProbeNode. Add tests for correct handling.
@chumer please have a look at tests failing for automatically generated wrappers