• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to debug multithreaded application?  RSS feed

 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to debug our multi threaded application (non gui) to fix 1 client bug. Normally i can debug in eclipse but have never debug in multi threaded environment.

I am unable to find any good resources. Any help is appreciated?
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What problems have you encountered when debugging the application in Eclipse? And what kind of "resources" are you looking for? I've debugged a multi-threaded application in Eclipse without realizing that I had to know anything special, and I didn't run into any problems really.
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problems like identifying deadlock, method and variables process by any thread and switching between threads.

I was looking for resources to identify this problem may be any tool (I just found out about JProfiler and YourKit) or documentation of how to perform debugging in eclipse in multi threaded environment.

I agree i don't have very much exposure to eclipse debugging too.
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The debug window shows you all active threads separately. To examine the variables in a thread you just set a breakpoint and when a thread reaches that breakpoint it will stop and allow you to do that -- just like normal for Eclipse. To "switch threads" -- if I'm interpreting that right -- you just click on a different thread in the debug window. Identifying deadlock -- well, the debug window tells you about locks held by the threads. Really, this is a non-problem. I'm guessing you haven't even tried it yet.
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I swear i tried but could not able to understand it. Thanks..
 
Santosh Kumar Nayak
Ranch Hand
Posts: 193
Eclipse IDE IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Hands on JProfiler as it will give a upper hand in narrowing down to detect Deadlock between threads

Its a good idea to take multiple Thread dumps in an interval of 5-10 secs so that you can compare the activity of threads in different dumps.

If you have jstack on the machine where process is running,
jstack {pid} > threaddump.log
kill -3 {pid}
Using jvisiualvm or jconsole, you can connect to the local/remote process and generate the thread Dump.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!