-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
The results produced by Gorame and Gin when encountering a context canceled in the http server are inconsistent. #2966
Comments
要不你试试这样? r := gin.New()
r.GET("/ces", func(c *gin.Context) {
time.Sleep(3 * time.Second)
fmt.Println("contextErr,,", c.Err())
fmt.Println("Request contextErr,,", c.Request.Context().Err())// here
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
r.Run() |
How about you try this? r := gin.New()
r.GET("/ces", func(c *gin.Context) {
time.Sleep(3 * time.Second)
fmt.Println("contextErr,,", c.Err())
fmt.Println("Request contextErr,,", c.Request.Context().Err())// here
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
r.Run() |
你好,用下面这个断点调试可以了,请问下为何在断点调试过程中需要调用 c.Request.Context().Err(),才会触发contex cancled 。如果不调用,contex的err状态会在执行到finishRequest才触发,可有相关资料或源码指点一下 |
Hello, you can debug using the following breakpoint. May I ask why you need to call c.Request.Context().Err() during breakpoint debugging to trigger context canceled? If it is not called, the err status of contex will not be triggered until finishRequest is executed. Can you provide relevant information or source code? |
@merlin888888 你好,你的 |
@merlin888888 Hello, your |
Environment description
use gf HTTP Server like this,No server timeout has been set。default configuration
use Gin HTTP Server like this
use http Client like this,No server timeout has been set。default configuration
use Goland DEBUG show this
What did you expect to see?
The results of Gorame and Gin are inconsistent. Could you please explain what kind of processing Gorame is performing that could lead to this result? In other Http invocation processes, the cancellation of the context is only cancle by the standard library http/server when it reaches finishRequest.
Gorame运行的结果和Gin运行结果不一致,请问Gorame是进行怎样的处理导致出现此种结果。在其它框架Http调用过程中,context的cancle由标准库http/server在执行到finishRequest才会cancle。请问下当前框架层面是如何监听并处理context cancle的?
The text was updated successfully, but these errors were encountered: