Multithread debugging
Answered
I'm trying to perform a remote debug in thread mode. But I catch too many threads on breakpoint. And debugger starts to jump between threads when I click "next step".
What to do with it?
Please sign in to leave a comment.
Hi Ilya,
I'm afraid I don't understand what behavior would you expect from the ide here? It stops on break points and, as far as I understood, break points are hit often at your application
Denis
Examle: web page sends 5 requests that all get through my class. So I catch them all on my breakpoint. Then I switch off the breakpoint, so new threads can't be caught.
For example debugger is in thread #1. Then when I click "next step", debugger instead of staying in current thread, moves to another thread(#2,3,...).
Sometimes it happens even without clicking "next step": Information about variables of thread #1 doesn't end loading, but debugger jumps to another thread.
I've found the same question asked 10 years ago, but it also wasn't answered. http://devnet.jetbrains.com/message/556661#556661
AFAIK debugger api doesn't provide a notion of step and its implemented via setting temporary break point at the target instruction and then remove it when control flow reaches it.
Regarding your situation - as soon as your breakpoint is hit, you can mark current thread and define a condition for all other break points like 'Thread.currentThread() == myMark_DebugLabel'
And yes, debugging concurrent processing is a complicated task.
Denis
It does not explain such behavior.
I place brreakpoint at line 100. Then I turn it off. When I click "next step" temporary breakpoint is placed at line 101(roughly) and current thread is unpaused. So I should get current thread caught at line 101, because the only active breakpoint is temporary and only current thread gonna hit it. But instead of it I get another thread at line 100.
In this situation I can't even determine which of 5 threads is mine. (Server stands in another city, so info loads slowly)
What to do in this situation?
Will ask our engineer who is responsible for debugging to have a look here.
Denis
Any update here?
Hi Mm989 Please check the following tutorial https://www.jetbrains.com/help/idea/detect-concurrency-issues.html . If this is not what you need describe your case in a bit more detail.
Thank you!