I'm currently trying to write a new program, but for some reason my eclipse is suspending every 30 seconds or so. I think that it has something to do with the new code I've been writing.
I'm using eclipse 21-03, my Wildfly Server is Version 21.0.2 and I'm using openJDK-11.
I already tried giving eclipse more RAM, that didn't help.
You can see a picture of my Taskmanager attached. Eclipse is still using so much RAM although I stopped the server as well as the programm. What do I have to do to suspend the workspace task but not stop eclipse from running?
1.5 GB is quite normal for Eclipse. Sadly. RAM hog.
There are two possiblilities why Eclipse is suspending code:
You have set breakpoints, that are manual instructions that tell Eclipse to stop in Debugging Mode. They are little blue dots on the line numbers in the code window.
Some Exceptions fall all the way through the Stack Trace unhandled. If this happens in Debug Mode, Eclipse will halt where the Exception is thrown and tell you the reason.
Solutions:
Improve your code so that the Exceptions do not fall through. Use try-catch
Remove breakpoints you set
Do not run your app in Debug mode, but in normal run mode. This way the debugger is not attached an will not interrupt "normal" flow.
Example of an exception break in debug mode:
The popup shows that x is null, so accessing x.length() will throw a NullPointerException (NPE) that is not caught but crashes through to the Thread
In the bottom right, the Debug View shows where and why execution is halted.
Related
A quick answer would be "without crying" of course :).
I have a really strange problem with my Java application (J2SE 1.7) on a Win7 32bits system. I encountered all the cases :
Sometimes it goes out of memory of Java heap (and so I can log it and recover from this)
Sometimes it crash in the native and I have the hs_err_pidxxxx.log file and I can analyze what is going on.
Sometimes it crash in the native and I have no hs_err file but I have a popup java stop functioning and I can see the exception in windows event log and even debug with visual some part of the process.
Sometimes it crash and I have nothing (no hs_err, no popup, nothing...). It just ends all like if there were an System.exit() or a native exit() call.
So my question is :
how can I be sure this is a native exit call as I don't have all the code of native libraries I am using ?
Is it possible to have this strange behaviour produced by another mean ?
Finally how to debug and track which lib can be the root cause ?
how can I be sure this is a native exit call as I don't have all the
code of native libraries I am using ?
The only way I know to be sure would be to wrap the call to a native library with logging commands so you log before each call and after each return. After your program has crashed if the log has an enter message but no return message then that library call is suspect.
Is it possible to have this strange behaviour produced by another
means ?
Yes there are an infinite number of strange other means.
Using up memory or some other resource might be one explanation.
Finally how to debug and track which lib can be the root cause ?
Logging described above should find this too if the messages are specific to which library is being called. You can monitor the application in jconsole to see if it is using up tons of memory or threads. Disable anything that can be disabled so you can eliminate it as being part of the problem. If the problem goes away enable things one at atime until the problem returns.
How can I be sure this is a native exit call as I don't have all the code of native libraries I am using?
Debug it.
Is it possible to have this strange behaviour produced by another mean?
Hard to tell... Could be threading, could be memory leak, ...
Finally how to debug and track which lib can be the root cause?
Run Java with
-XX:+CreateMinidumpOnCrash
and you'll get a crash dump that you can analyze. Or use
-XX:+UseOSErrorReporting
to let Windows handle the crash (which will e.g. show a message to attach a debugger, depending on what you have installed. It might as well show "Send to Microsoft" error report.).
I have a problem while debugging in IntelliJ IDEA, it hangs in debug mode on break point in listeners in javafx application. I tried to increase heap space, but it's not help. Maybe someone had such problem too, please, suggest me what to do.
Set this as a VM parameter:
-Dsun.awt.disablegrab=true
It will mess up drag-and-drop, and leave an artifact on your screen while the debugger is paused - but it will let you debug. It happens whenever you block the JavaFX thread.
This can happen for a simple reason: The application has a lock on the desktop, for example a modal dialog or a popup or an open menu. Then it stops in a breakpoint. This notifies the IDE. Now the IDE tries to do something on your desktop but can't since the application still has a lock on the whole desktop -> deadlock.
You can use a tool like Chronon which records the whole program and lets you move back and forth on the timeline.
The last option is logging or poor man's debugger (System.out) instead.
[EDIT]
it's hard to check with System.out which of 20 parameters not equal.
It's actually pretty easy:
System.out.println("check");
if(!a1.equals(b2)) System.out.println(a1+"!="+b1);
Then duplicate the last line. That way, you will only get output when something is actually interesting (and not for the 19 equal parameters). Add some patterns to the output if you can't distinguish aX from aY (i.e. both are true):
if(!a1.equals(b2)) System.out.println("a1:"+a1+"!="+b1);
I am debugging an application with lots of threads. My breakpoints are set to suspend the whole VM.
When a thread hits one of the breakpoints, I then want to use Step Over. But this appears to resume the whole VM, until that step completes.
It'd really help if I could step just the single thread that hit the breakpoint.
Is there any way to do this in IntelliJ 11.1 / Java 6? (Hope I'm not missing something obvious...)
This feature was added in IntelliJ 16 (the issue CrazyCoder referenced in his answer was resolved)
More details here:
https://blog.jetbrains.com/idea/2016/02/intellij-idea-16-eap-improves-debugger-and-adds-git-worktree-support/
NetBeans can resume individual threads. While in debug mode, you can resume a thread from the left thread list by pressing a small button shaped like Play (►) near the thread.
Currently there's no such possibility because it may lead to deadlocks. You may vote for IDEA-43728 though.
I am debugging RCP( multi-threaded GUI application) using Eclipse Helios.
When I am executing the same method, I get a null pointer exception in run mode, but in
debug mode, I don't get any exception. I think it works fine in Debug mode.
Null pointer exception doesn't come in debug mode , but in run mode only..
Please help me out. Could it be a multi-threading issue.
Different behavior in run and debug mode is not unusual. Once I spent a day to find that a toString() had side effects. The debugger calls this method when displaying variables. Another reason for differences is concurrency. The execution order in the debugger may be different from run mode.
You can add a breakpoint to the line that NPE happened in run mode. And you need set the property of breakpoint to pause the entire vm.
Then debugging your program, the entire vm will be suspended when a thread tries to execute that line. You can let other threads which don't try to execute that line to resume, the second thread will be suspended on that line as well. You can analysis the flaw of your code.
Please check whether you have used for each to traverse a collection. The traversal order of the collection may be inconsistent between run and debug, which may lead to different results.
While debugging, my Eclipse pause on same line every time. I read this Eclipse pausing without a breakpoint, but there are no exceptions in my console. I also read this Why does my Eclipse project have phantom debugger breakpoints?, but it doesn't help too.
The code that pauses debugger without breakpoint is this:
Query query = sessionFactory.getCurrentSession().createQuery(hql);
I think there's no problem with createQuery(). Whenever getCurrentSession() called, my Eclipse pauses. Why is this happening?
Look into concurrency. Maybe ur running into situations like deadlock. It happens when two objects are not locked in the same order, causing two different threads to be waiting for each other to release other object.
At this point it appears that the entire program has paused. Maybe its whats happening, but cant say for sure until I can see the code.
Sometimes I face this kind of problem and everytime I end up finding out that my java code is not synchronized with my .class, this happens when I'm in remote debugging. Try to close your eclipse, clean your project and then try again. If you're debugging remotely, update your source codes.
Cheers!
Simple. Application always multithreading.. Obvously that application stop in another thread. When you analyze on which tread Eclipse stop and click on this thread - you found that Eclipse starts to react on command.