Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread block issue  RSS feed

 
Ruhi Akhtar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have thread lock or object lock happening in my java program. A jave thread in the while loop is accessing another object and receiving data.
example is similar as follows:-

class A // class containing thread
{
public void run()
{
while(bRun)
{
try
{
System.out.println("going to receive");
objB.receive();
System.out.println("done receiving");
}catch(Throwable b)
{
System.out.println("some problem in thread");
bRun = false;
}
}
System.out.println(" thread exits");
}
}
Class B
{
public String receive()
{
....
}
}
}

After getting System.out.println for a while I see that thread getting stuck and seems to be blocked in calling receive on object of class B. The program output looks like

going to receive
done receiving
going to receive
done receiving
going to receive
done receiving
going to receive
- The thread gets stuck here, is blocked.

I don't have nay other module accessing Class B's receive and there are no locks on methods of object b.
Anybody having an idea of what might be happening here.
I appreciate your response.

Thanks,
Akhtar
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody having an idea of what might be happening here.
I appreciate your response.


Well, since in your code listing, you commented out the source for the recieve() method, I am pretty sure that you know more than any of us what is happening in the method...

Henry
 
Ruhi Akhtar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I was not clear in my earlier email. I like to change my question that Is there any way I can monitor thread activity on Linux machine knowing pid of the process. I tried pstack, but Linux EIS 4 doesn't seem to be supporting it.

I have thread deadlock and would like to use some tools that I can run externally to monitor the thread activities.

Thanks,
Akhtar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!