-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: HTTP large file upload fails with "bufio: buffer full" #26707
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
I wasn't able to reproduce this on go1.10.3 darwin/amd64. |
I did reproduce the error and then it magically went away after a few runs. I am trying to see if I can cause it to happen again. |
If anything, I suspect this is a "mime/multipart" bug and not a "net/http" bug. |
Hi Julien! I think the error is that you forgot to check the return value from It probably failed because The next time you call I think after this kind of error (having a partially read buffer with some parts discarded), subsequent calls to |
Hey @mvanotti ! Long time no see! |
Confirmed on another system that the error I'm seeing is due to limited I'd be nice to not be limited by |
You can change the TempDir in linux by setting the If that's not OK, then setting the tmpfile folder for the multipart package would need to either allow to set it in the |
Regarding the error, I still think that the way |
Since I don't think the solution is to try and change where |
Uploading large files in HTTP multipart POST requests fails with
multipart: NextPart: bufio: buffer full
.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
)?What did you do?
The following source code accepts uploads requests over HTTP. It works fine for files up to 15GB, but crashes for 20GB files with the error:
multipart: NextPart: bufio: buffer full
Here's an example run with a 20GB file filed with zeroes.
$ go run multipart.go 2018/07/31 08:29:18 POST HTTP/1.1 /upload user-agent=curl/7.59.0 2018/07/31 08:29:18 parsing multipart form 2018/07/31 08:29:43 failed to read uploadfile form field: multipart: NextPart: bufio: buffer full
upload with curl:
Since my machine has 32GB of RAM, I tried boosting MAXMEMORY to 30GB by setting
r.ParseMultipartForm(3000000000)
but got the same results.The text was updated successfully, but these errors were encountered: