You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Kousuke Saruta (JIRA)" <ji...@apache.org> on 2014/11/10 20:33:34 UTC

[jira] [Created] (SPARK-4323) Utils#fetchFile method should close lock file certainly

Kousuke Saruta created SPARK-4323:
-------------------------------------

             Summary: Utils#fetchFile method should close lock file certainly
                 Key: SPARK-4323
                 URL: https://issues.apache.org/jira/browse/SPARK-4323
             Project: Spark
          Issue Type: Bug
          Components: Spark Core
    Affects Versions: 1.3.0
            Reporter: Kousuke Saruta


In Utils#fetchFile method, lock file is created like as follows.

{code}
      val raf = new RandomAccessFile(lockFile, "rw")                                                                                                          
      // Only one executor entry.                                                                                                                             
      // The FileLock is only used to control synchronization for executors download file,                                                                    
      // it's always safe regardless of lock type (mandatory or advisory).                                                                                    
      val lock = raf.getChannel().lock()                                                                                                                      
      val cachedFile = new File(localDir, cachedFileName)                                                                                                     
      try {                                                                                                                                                   
        if (!cachedFile.exists()) {                                                                                                                           
          doFetchFile(url, localDir, cachedFileName, conf, securityMgr, hadoopConf)                                                                           
        }                                                                                                                                                     
      } finally {                                                                                                                                             
        lock.release()                                                                                                                                        
      }  
{code}

If some error occurs between opening RandomAccessFile and getting lock, lock file can be not closed.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org