Skip to content

io: Copy leaves file zero bytes in Azure AKS with CIFS — Go1.15 regression #42400

Closed
@alhails

Description

@alhails

What version of Go are you using (go version)?

$ go version
1.15.2

Does this issue reproduce with the latest release?

Yes (1.15.3)

What operating system and processor architecture are you using?

The issue is reproduced on Azure AKS node (Ubuntu 16.04 kernel 4.15.0-1098-azure)

What did you do?

We have a golang API running in Azure AKS. The initial problem was noticed with file upload via http multipart request. After upgrade to go 1.15, uploaded files were left as zero bytes. Before this, uploads were working fine.

My initial suspicion was that the problem was related to the addition of the copy_file_range syscall in os.File ReadFrom, but also our use of a CIFS file share for our running pod.

I have only been able to reproduce in AKS, not locally.

I've reproduced the issue with a very simple golang code example..

package main

import (
 "fmt"
 "io"
 "os"
)

func main() {
 src, err := os.Open("source.txt")
 if err != nil {
  fmt.Printf("Failed to open file: %s\n", err.Error())
  return
 }

 dst, err := os.Create("dest.txt")
 if err != nil {
  fmt.Printf("Failed to create file: %s\n", err.Error())
  return
 }
 _, err = io.Copy(dst, src)
 if err != nil {
  fmt.Printf("Failed to copy file: %s\n", err.Error())
  return
 }
}

When this is executed on the container file system, the file is copied correctly.
When this is executed on a CIFS volume in the container, the file is created but is left as zero bytes.

I now suspect that the issue is with the kernel or CIFS, so have raised an issue with the team responsible for the azure linux kernel - https://answers.launchpad.net/ubuntu/+source/linux-azure/+question/693837

However I thought I might also raise it here, in case anyone here has any thoughts on this issue.

Thanks

Alastair

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions