aspose file tools*
The moose likes Threads and Synchronization and the fly likes Hung Threads - Can they be ignored if got recoevered.?  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Hung Threads - Can they be ignored if got recoevered.?  " Watch "Hung Threads - Can they be ignored if got recoevered.?  " New topic
Author

Hung Threads - Can they be ignored if got recoevered.?

Waez Ali
Ranch Hand

Joined: Jan 24, 2005
Posts: 43
Hello there,

I am supporting a vendor application, recently implemeted a new release but soon started getting the hung threads in sysout logs specially when a critical process is running. The thread remains hung for about 10 to 12 minutes and then getting released on it's own. We have reported this to Vendor but they say it can be ignore since threads are eventually getting completed..and they also mentioned that same application is running in other organization but no one has reported this issue.. It could be the WAS/infrastructure issue..another suggestiong is to increase the thread monitoring time out at WAS level.

I am not quite satisfied, what I understand is that when you have a hung thread it's going to consume system resources which is not good. I would like to know your oponion/advise..

- Can we really ignore hung threads if they get recovered ?
- Is it advisable to change the standard settings in WAS ( monitoring time out ) to avoid seeing this error in logs ?

I would much appriciate your suggestion/comments. - Thank You.

--------------SYSLOGS ---------------------------

[1/5/14 3:12:39:473 GMT] 00000003 ThreadMonitor W WSVR0605W: Thread "MessageListenerThreadPool : 918" (000003df) has been active for 669232 milliseconds and may be hung. There is/are 1 thread(s) in total in the server that may be hung.
at oracle.jdbc.driver.T2CStatement.t2cFetch(Native Method)
at oracle.jdbc.driver.T2CPreparedStatement.fetch(T2CPreparedStatement.java:953)
at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:314)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:228)
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.next(WSJdbcResultSet.java:3120)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:284)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1036)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)

[1/5/14 3:30:03:229 GMT] 000003df ThreadMonitor W WSVR0606W: Thread "MessageListenerThreadPool : 918" (000003df) was previously reported to be hung but has completed. It was active for approximately 1712988 milliseconds. There is/are 0 thread(s) in total in the server that still may be hung.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

There are various reasons why a particular thread may (appear) hung. Some might end up in a deadlock and other might just be a case where the thread is active and is doing some long running task. Based on the stacktrace that you posted:


[1/5/14 3:12:39:473 GMT] 00000003 ThreadMonitor W WSVR0605W: Thread "MessageListenerThreadPool : 918" (000003df) has been active for 669232 milliseconds and may be hung. There is/are 1 thread(s) in total in the server that may be hung.
at oracle.jdbc.driver.T2CStatement.t2cFetch(Native Method)
at oracle.jdbc.driver.T2CPreparedStatement.fetch(T2CPreparedStatement.java:953)
at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:314)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:228)
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.next(WSJdbcResultSet.java:3120)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:284)


it looks like a case where a thread is being used for iterating over the results of some JDBC query and apparently that's taking a long time to complete (maybe the result set is huge). It looks like some monitoring infrastructure in the application server (WebSphere) considers that the thread might be "hung" based on some pre-configured timeout. I think, you could ask the vendor whether it is expected for a certain operation which is iterating over the records to take this long. Depending on how the application is written it could very well be a case where you have to either ignore these warnings or increased the pre-configured timeout.


[My Blog] [JavaRanch Journal]
Heena Agarwal
Ranch Hand

Joined: Dec 25, 2013
Posts: 261
    
    4
I think you don't know whether these threads are actually hung or if the message is just printed because some thread is taking longer than a pre configured time for all threads. I think it's a good practice to have these messages in the logs for debugging purposes and this message is just doing that. The good thing is the application has a log message to report that a thread that was reported as a hung thread was not hung.

But it is not advisable to arrive at a conclusion on things like whether there is something that needs to be fixed or improved upon based on just the log messages because you need to verify what the logs are saying by actually looking at the code and seeing what it is doing. It might be possible that the delay should be the intended behaviour - it's a database call. It's just taking a long time. Or it could be possible that something can be improved. Both the cases could be possible. I think there could be more cases also ( the case that the application is actually not calculating time correctly is an unlikely but possible case). So I think unless someone knows what is actually happening, they can't comment on it.

Whether the time should be increased or not may just depend on the average expected time for these threads to complete in most situations. Some applications might be designed such that the thread monitor monitors threads with a pessimistic approach in which case the time might be a shorter value. Some applications might follow an optimistic approach.

[ Edit : I didn't see Jaikiran's response when I started responding to this one.]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hung Threads - Can they be ignored if got recoevered.?