Yang Jie created HADOOP-20066:
---------------------------------

             Summary: LocalDirAllocator throws ArithmeticException instead of 
DiskErrorException when every directory with free space fails the write check
                 Key: HADOOP-20066
                 URL: https://issues.apache.org/jira/browse/HADOOP-20066
             Project: Hadoop Common
          Issue Type: Bug
          Components: fs
            Reporter: Yang Jie


When the size is unknown, AllocatorPerContext#getLocalPathForWrite picks a 
directory at random, weighted by its free space. If the chosen directory fails 
createPath(), its space is subtracted from {{totalAvailable}} and it counts as 
searched. A directory with no usable space still counts toward {{numDirs}}, so 
after every directory with space has failed, {{totalAvailable}} is 0 while 
{{numDirsSearched < numDirs}} still holds, and the next {{(r.nextLong() >>> 1) 
% totalAvailable}} throws "ArithmeticException: / by zero".

This needs two or more directories, at least one with no usable space, and 
every directory with space failing createPath(), for example a disk remounted 
read-only. The allocator only rebuilds its context when the configuration 
changes, so in a task or client JVM every such allocation fails from then on. 
Callers expect a DiskErrorException, which is an IOException; they get an 
unchecked exception instead, without the message that lists the directories.

The fix stops the loop once no space is left, so the existing 
DiskErrorException is thrown. HADOOP-9079 reported this case in 2012 with the 
same change, but it was never committed.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to