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

net/http: FileServer on WSL fails with wget and curl for files over ~4MB #27128

Open
upsampled opened this Issue Aug 21, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@upsampled

upsampled commented Aug 21, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build493773858=/tmp/go-build -gno-record-gcc-switches"

using WSL

Ran the same test on a CentOS Machine and I did not see this problem

What did you do?

Attempted to server files via HTTP that an application using curl can download.

package main

import (
        "log"
        "net/http"
)

func main() {
        fs := http.FileServer(http.Dir("./"))
        http.Handle("/repo/", http.StripPrefix("/repo/", fs))

        log.Println("Listening...")
        http.ListenAndServe(":80", nil)
}

What did you expect to see?

Curl to download the files.

What did you see instead?

The file server worked for file that were roughly less than 5M, but failed for larger files with curl error 18. The curl command line tool also reproduces this error:

curl http://<IP>/repo/<FILE> --output <FILE>
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                                    Dload  Upload   Total   Spent     Left  Speed
 56 7257k   56 4096k    0     0      4970k      0       0:00:01 --:--:--  0:00:01 4970k
curl: (18) transfer closed with 3237034 bytes remaining to read

Wget (busybox version) also has the same problem:

wget http://<IP>/repo/<FILE> -O <FILE>
Connecting to <IP> (<IP>:80)
pa-config-1-r0.corte   6% |**********                                                      |   460k  0:00:14 ETA
<STOPS and the file is only ~4M>

However using pythons web server, wget and curl both work
sudo python3 -m http.server 80

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 22, 2018

The WSL team want you to file bugs to them about any differences from actual Linux.

We generally don't investigate these things, or only do some when it appears we might be violating Linux or POSIX APIs in undocumented ways, or do so out of curiosity.

But please file a WSL bug and link it here.

We probably won't be investigating this. It's WSL's job to act like Linux and they don't want projects treating them like its own port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment