Skip to content

net: sendfile on macOS doesn't send large files #70228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eikemeier opened this issue Nov 6, 2024 · 3 comments
Closed

net: sendfile on macOS doesn't send large files #70228

eikemeier opened this issue Nov 6, 2024 · 3 comments

Comments

@eikemeier
Copy link

Go version

go version go1.23.2 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='~/Library/Caches/go-build'
GOENV='~/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='~/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='~/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.23.2/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.23.2/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='on'
GOTELEMETRYDIR='~/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='~/sendfiletest/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/n9/_x_dtls50d54kkjvqf934s580000gn/T/go-build860831848=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Run the sample from github.com/eikemeier/sendfiletest:

git clone https://github.com/eikemeier/sendfiletest.git
cd sendfiletest
go test .

What did you see happen?

--- FAIL: TestSendfile (0.22s)
    sendfile_test.go:111: received 354712352 bytes; expected 1073741824
    sendfile_test.go:115: retrieved data hash did not match
    sendfile_test.go:119: sent 354712352 bytes; expected 1073741824
FAIL
FAIL	github.com/eikemeier/sendfiletest	0.419s
FAIL

What did you expect to see?

ok  	github.com/eikemeier/sendfiletest	0.823s

If you prevent the usage of sendfile by commenting in the line f := io.NopCloser(f) (hiding the underlying os.File), the test runs though. Also, when you send smaller files.

The test is a simplified copy of go1.23.2/src/net/sendfile_test.go, but creates and sends a larger test file than the one used in the repository.

@diwasrimal
Copy link

I guess this is a duplicate of #70000 which has been fixed and is coming on 1.23.3

@seankhliao
Copy link
Member

Duplicate of #70000

@seankhliao seankhliao marked this as a duplicate of #70000 Nov 6, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants