Eclipse debugger always blocks on ThreadPoolExecutor without any obvious exception, why?
If Eclipse debugger is halting during ThreadPoolExecutor
execution, follow these steps to reveal the origin of the exception:
- Open the Breakpoints tab in Eclipse
- Right-click -> "Add Java Exception Breakpoint"
- Enter "java.lang.Exception" or a specific exception class
- Check the "Caught" and "Uncaught" options to catch all relevant exceptions
- Click on "OK" and debug. It willautomatically stop at the occurrence of the exception
Unraveling daemon threads mysteries
Daemon threads in backends such as Tomcat, Hibernate, or Spring can throw runtime exceptions. The debugger routine halts in the tracks even if these exceptions aren't fatal to the threads.
Mitigating uncaught exceptions
To avoid unnecessary stops while debugging in Eclipse:
- Go to Preferences -> Java -> Debug
- Uncheck the group of friends nobody invited to the party: "Suspend execution on uncaught exceptions"
Alternatively, edit your Exception Breakpoints properties to exclude ThreadPoolExecutor.
Framework peculiarities
Playing nice with Tomcat
- Update your beast, Tomcat, to version 7.0.54 or higher to fix the critter messing up your debugging process.
- Give it a good old restart. Everybody needs a fresh start once in a while, right?
Harmonizing with Spring and Hibernate
- Tools like JRebel can be a real game-changer, handling hotswapping and easing your debugging life.
- Be aware that hotswapping in Spring Tool Suite (STS) might cause the debugger to halt.
Navigating ThreadPoolExecutor exceptions
Revising your approach
Know that frameworks could be using ThreadPoolExecutor under the hood, leading to unexpected breakpoints. Removing or filtering out breakpoints on the ThreadPoolExecutor can save you from involuntary debugger vacations.
Fine-tuning breakpoints
Setting breakpoints for specific runtime exceptions can streamline your debugging process.
Mastering the Eclipse debugger
Revealing hidden problems
With VisualVM you can monitor, troubleshoot and profile Eclipse, enhancing your debugging tools.
Confronting the invisible enemy
Uncaught exceptions thrown by a daemon thread might seem like a phantom menace. But with the right use of breakpoints in Eclipse, you reveal and confront them.
Pivoting your focus
Suspect higher-level code for uncaught exceptions. The ThreadPoolExecutor might just be an innocent bystander in this mystery.
Was this article helpful?