Friday, July 31, 2009

A way to find thread hang problem

Got a conference call in the early morning two days ago, and it was from operation team. It was reported that one of our apps in production had problem with thread hanging.

I bet thread dump would tell me something, so I took more than 10 thread dumps within 20 minutes. And then examined the thread dump and quickly found a thread which running over 20 minutes. And that thread tried to retrieved data from one of our internal server. After restarting that internal server, the thread hanging problem was gone.

During the working hour, I looked at the piece of code which called that internal server. Found it out it used URLConnection. As we use JDK 1.4, URLConnection does not have timeout function.

With Google search, found potential solution:
http://www.tek-tips.com/viewthread.cfm?qid=1219068&page=1

No comments:

Post a Comment