Bug 571219 - Exceptions from evaluating snippet cause the debugging application to crash
Summary: Exceptions from evaluating snippet cause the debugging application to crash
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.19   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 571220
  Show dependency tree
 
Reported: 2021-02-15 14:35 EST by Gayan Perera CLA
Modified: 2023-02-19 03:42 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2021-02-15 14:35:28 EST
public class Test {
  public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
			
			@Override
			public void uncaughtException(Thread t, Throwable e) {
				e.printStackTrace();
			}
		});

    System.out.println("hello world");
  }
}

Add a debug point in sysout statement and evaluate the following snippet.

java.util.Arrays.asList(1).get(2)


This will cause the current thread to handle the exception which was thrown from evaluating snippet. A application which handles uncaught exception and exit the VM will cause the application to stop due to a evaluation.
Comment 1 Gayan Perera CLA 2021-02-16 05:30:33 EST
Tried the look at it more closer, but i cannot reproduce this bugs any more. I will check more its something due to the java version i was using.
Comment 2 Gayan Perera CLA 2021-02-16 06:03:36 EST
Checking further it seems my application is not crashing due to default uncaught exception handler because the exception raised from the evaluation doesn’t get handled by DUEH or thread’s UEH. 

A interesting observation is that if you throw a exception in evaluation the current thread dies. This is not observed in Intellij. So may be this is the reason my application crashes.
Comment 3 Gayan Perera CLA 2021-02-16 11:53:40 EST
From my tests i found out the current suspend thread doesn't crash if the evaluated method throws a exception.

But if you evaluate something like
throw new RuntimeException()

this cause the suspended thread to die.
Comment 4 Eclipse Genie CLA 2023-02-19 03:42:38 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.