Github user manbuyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21175#discussion_r184727560
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/io/ChunkedByteBuffer.scala ---
    @@ -63,10 +63,12 @@ private[spark] class ChunkedByteBuffer(var chunks: 
Array[ByteBuffer]) {
        */
       def writeFully(channel: WritableByteChannel): Unit = {
         for (bytes <- getChunks()) {
    -      while (bytes.remaining() > 0) {
    +      val curChunkLimit = bytes.limit()
    +      while (bytes.hasRemaining) {
             val ioSize = Math.min(bytes.remaining(), bufferWriteChunkSize)
             bytes.limit(bytes.position() + ioSize)
             channel.write(bytes)
    +        bytes.limit(curChunkLimit)
    --- End diff --
    
    Right. When channel write throw IOException


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to