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

the BufferedInputStream will not be closed if an exception occurs

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: Spark Core
    • Labels:
      None

      Description

      EventLoggingListener use

       val in = new BufferedInputStream(fs.open(log))
      

      and will close it if an exception occurs

      val codec = codecName.map { c =>
            codecMap.getOrElseUpdate(c, CompressionCodec.createCodec(new SparkConf, c))
          }
      
      try {
            codec.map(_.compressedInputStream(in)).getOrElse(in)
          } catch {
            case e: Exception =>
              in.close()
              throw e
          }
      

      But, if

      CompressionCodec.createCodec(new SparkConf, c)
      

      throws an exception, the BufferedInputStream

      in
      

      will not be closed anymore.

        Attachments

          Activity

            People

            • Assignee:
              zuo.tingbing9 zuotingbing
              Reporter:
              zuo.tingbing9 zuotingbing
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: