Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-4323

Utils#fetchFile method should close lock file certainly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 1.3.0
    • None
    • Spark Core
    • None

    Description

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

            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()                                                                                                                                        
            }  
      

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            sarutak Kousuke Saruta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: