-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
When doing a large upload, I get a timeout if the upload takes more than 1 minute -- even if the client is steadily providing data. The server should not timeout if while the client is providing data.
The error I see in my logs comes from here (line 49 in params.go):
if err := req.ParseMultipartForm(32 << 20 /* 32 MB */); err != nil {
WARN.Println("Error parsing request body:", err)
In revel/server.go, I noticed the server timeouts are set, so I was able to work around my issue with:
init() {
revel.OnAppStart(fixServerTimeout)
}
func fixServerTimeout() {
revel.Server.ReadTimeout = 0
revel.Server.WriteTimeout = 0
}
which is neither documented or intuitive, but does work.
I think your intention may have been to timeout if the client does not provide data for a minute, or if the server fails to respond after a minute.
Consider, however, the case where the client is uploading a huge file: the server does not respond for a minute because it is still reading, which is perfectly legitimate. However, since it's not writing for a minute, it times out because of the write timeout (Another workaround might be to use threading and send continues).
I don't think the server read/write timeouts should be set at all, or if they are, they should be larger and configurable in the conf file.