-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: FileServer on WSL fails with wget and curl for files over ~4MB #27128
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
Comments
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. |
i run into the same issue and while debugging it i saw that CopyN in the fileserver returns EOF early: @bradfitz i wondered if the ignored error could be checked and logged to make easier to debug issues happening there? |
Logging the error returned by CopyN could help finding the root cause of issues like golang#27128.
Change https://golang.org/cl/191971 mentions this issue: |
The errors returned during copying the file content in ServeContent, ServeFile and FileServer were ignored to avoid excessive, meaningless logging. This commit introduces error filtering and logging to ensure that the errors occurring during reading the content are logged. Updates golang#27128
The errors returned during copying the file content in ServeContent, ServeFile and FileServer were ignored to avoid excessive, meaningless logging. This commit introduces error filtering and logging to ensure that the errors occurring during reading the content are logged. Updates golang#27128
The errors returned during copying the file content in ServeContent, ServeFile and FileServer were ignored to avoid excessive, meaningless logging. This commit introduces error filtering and logging to ensure that the errors occurring during reading the content are logged. Updates golang#27128
The errors returned during copying the file content in ServeContent, ServeFile and FileServer were ignored to avoid excessive, meaningless logging. This commit introduces error filtering and logging to ensure that the errors occurring during reading the content are logged. Updates golang#27128
Errors returned during copying the file content in ServeContent, ServeFile and FileServer were ignored to avoid excessive, meaningless logging. This commit introduces error filtering and logging to ensure that the errors occurring during reading the content are logged. Updates golang#27128
Errors returned during copying the file content in ServeContent, ServeFile and FileServer were ignored to avoid excessive, meaningless logging. This commit introduces error filtering and logging to ensure that the errors occurring during reading the content are logged. Updates golang#27128
Curiously I'm seeing the same effect. But instead of trimming the file, net/http (or something in between) changes the file somehow, starting at position 0x00400000 (exactly 4Mb) serves something different, it's very odd. As HTTP client, I tried downloading the file in Chrome running in windows (while the server was local in WSL). And then I tried wget runnint from within WSL. Both Chrome and wget in WSL download the same altered file (the size remains the same). go 1.15.5 here. But I've noticed that werving in WSL didn't work for a long time now. If I serve the same file with:
it works. |
For others bumping into this, if I change the following in my server code:
To:
Using the |
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.
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:Wget (busybox version) also has the same problem:
However using pythons web server, wget and curl both work
sudo python3 -m http.server 80
The text was updated successfully, but these errors were encountered: