-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
DATA RACE: Is this an Echo Data Race or is it something I am doing #2306
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
without seeing the code, probably easiest would be just to drop the timeout middleware. |
I have just read the WARNING, in |
I strongly recommend rethinking if you really need timeout middleware at all. If you have upstream proxies like Nginx/Apache etc you do not need timeout mw as these services have it built in. Are you adding because it might be useful or you have some specific requirement to fullfill? like requests can not be longer than X seconds (not this requirement can not work well with filedownloads because clients with bad connect ala mobile can take considerable more time to download files). Or requirements - even if request ends the transactions must be commited. These are some of reasons I have seen people try to use timeout mw. |
Thanks for the advice @aldas. It is a situation where I do not want tasks to take too long, and would rather return an error in those situations - I could deal with this at another level, and not make use of the middleware. |
If you are not dealing with transactional data you could use and func main() {
e := echo.New()
s := http.Server{
Addr: ":8080",
Handler: e,
ReadTimeout: 0,
ReadHeaderTimeout: 0,
WriteTimeout: 0,
IdleTimeout: 0,
MaxHeaderBytes: 0,
}
if err := s.ListenAndServe(); err != http.ErrServerClosed {
log.Fatal(err)
}
} |
closing, when requests need to be limited I think https://github.com/labstack/echo/blob/master/middleware/context_timeout.go limiting context deadline is solution - when deadline is hit, then contextaware methods will return and handler eventually ends. |
Issue Description
I am experiencing a
DATA RACE
and I am not sure what the cause is. Is this an Echo Issue or is it something that I am doing?I interpret this as the context is being reset, the
write
operation, while I try toread
the request :echo.Contex.Request()
.The text was updated successfully, but these errors were encountered: