hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Bad concurrency bug in 0.12.3?
Date Fri, 01 Jun 2007 16:39:46 GMT
Calvin Yu wrote:
> The problem seems to be with the MapTask's (MapTask.java) sort
> progress thread (line #196) not stopping after the sort is completed,
> and hence the call to join() (line# 190) never returns.  This is
> because that thread is only catching the InterruptedException, and not
> checking the thread's interrupted flag as well.  According to the
> Javadocs, an InterruptedException is thrown only if the Thread is in
> the middle of the sleep(), wait(), join(), etc. calls, and during
> normal operations only the interrupted flag is set.

I think that, if a thread is interrupted, and its interrupt flag is set, 
and sleep() is called, then sleep() should immediately throw an 
InterruptedException.  That's what the javadoc implies to me:

   Throws: InterruptedException - if another thread has interrupted
   the current thread.

So this could be a JVM bug, or perhaps that's not the contract.

I think we should fix this as a part of HADOOP-1431.  We should change 
that to use the mechanism we use elsewhere.  We should have a 'running' 
flag that's checked in the thread's main loop, and method to stop the 
thread that sets this flag to false and interrupts it.  That works 
reliably in many places.

Perhaps for the 0.14 release this logic should be abstracted into a base 
class for Daemon threads, so that we don't re-invent it everywhere.


View raw message