[ 
https://issues.apache.org/jira/browse/HDFS-7282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14185468#comment-14185468
 ] 

Jinghui Wang commented on HDFS-7282:
------------------------------------

Hi Colin,
Thanks for taking a look at the patch. 

We saw the failures when running the UTs with IBM JAVA. In each one of the 
failed tests, the TemporaryScoketDirectory object is initialized, which creates 
the directory, but the objects are never used/referenced again, so they can 
poetinally get garbage collected and the finalize method is called for the 
object, which deletes the directory (see code snippted below). In our case, the 
TemporaryScoketDirectory is getting garbage collected before the datanode 
initializes and causing the FileNotFoundException.

{code: borderStyle=solid}
  @Override
  public void close() throws IOException {
    if (dir != null) {
      FileUtils.deleteDirectory(dir);
      dir = null;
    }
  }

  protected void finalize() throws IOException {
    close();
  }
{code}

> TestShortCircuitCache and TestBlockReaderFactory have failures caused by 
> TemporarySocketDirectory getting garbage collected before Datanode starts up 
> accessing the dir causing FileNotFoundException.
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-7282
>                 URL: https://issues.apache.org/jira/browse/HDFS-7282
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 2.4.1
>            Reporter: Jinghui Wang
>            Assignee: Jinghui Wang
>         Attachments: HDFS-7282.patch
>
>
> TemporarySocketDirectory has finalize method deletes the directory, in 
> TestShortCircuitCache and TestBlockReaderFactory, the 
> TemporarySocketDirectory created are not refereced later in the tests, which 
> can get garbage collected (deleted the dir) before Datanode start up 
> accessing the directory under TemporarySocketDirectory causing 
> FileNotFoundException.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to