Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange issue: thread stops without any apparent reasons.  RSS feed

 
Dmitry Zhuravlev
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code running:




I have a problem with this code: sometimes it stops after starting some task and never goes further and never starts other remaining tasks. I cannot understand why.

No exceptions are thrown and no uncaught exceptions can be thrown: all the code inside run() of my runnables is wrapped in try-catch(Exception e) block. The code just stops (or waits). I know that one of my runnables deals with HtmlUnit framework and this can be a reason for some problems: it can stop waiting for some network operation. OK, but why my CountDownLatch doesn't work?

Is there are any situations when the timeout in CountDownLatch class may not work and the thread will wait forever until countDown happens?

After this strange stop my application (running on Tomcat 6.0) continues to work and can respond to http responses.
Also I have not noticed this problem when running this code from Servlet of Filter. It looks like it happens only if I run the mentioned code from manually created thread.

A problem is that I am using this CoundDownLatch approach specially to make my system capable of going further while something wrong with one of the tasks. What I want is to forget about the tasks if it works longer than my timeout. And I use CountDownLatch for this. But it fails.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be a way to start debugging will be to take a thread dump of the process to find whether the thread is in await() or somewhere else.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!