-
Notifications
You must be signed in to change notification settings - Fork 71
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
"write tcp xxx:17947->yyy:20000: i/o timeout" occurs frequently #104
Comments
Would you please give an example just using getty without dubbo-go to reproduce this problem? |
I will try it, and I noticed that dubbo-go uses getty RPCClient to maintain multiple getty.Session, randomly selecting one for each request, which may be related to this. It is possible to obtain a session whose deadline is about to expire or has expired. |
This may be the same problem: AlexStocks#14 |
把超时时间设置短点 |
@rnben 不知道你的超时时间设置了多长?设置 3s 就足够了,不要太长,如 30s。 我们尝试修改下如下逻辑: // Optimization: update read deadline only if more than 25%
// of the last read deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime = time.Now()
if currentTime.Sub(t.rLastDeadline.Load()) > t.rTimeout.Load()>>2 {
if err = t.conn.SetReadDeadline(currentTime.Add(t.rTimeout.Load())); err != nil {
// just a timeout error
return 0, perrors.WithStack(err)
}
t.rLastDeadline.Store(currentTime)
} 为: timeDuration := t.rTimeout.Load()>>2
if timeDuration > 500e8 {
timeDuration = 500e8
}
currentTime = time.Now()
if currentTime.Sub(t.rLastDeadline.Load()) > timeDuration {
if err = t.conn.SetReadDeadline(currentTime.Add(t.rTimeout.Load())); err != nil {
// just a timeout error
return 0, perrors.WithStack(err)
}
t.rLastDeadline.Store(currentTime)
} |
What happened:
What you expected to happen:
The following configuration file shows that the
request-timeout
has been set to 1minute, which is valid.However, a write timeout error always occurs after multiple requests,In fact, the request does not exceed 10s!!
I find that commenting out
currentTime.Sub(t.wLastDeadline.Load()) > t.wTimeout.Load()>>2
can solve this problem.How to reproduce it (as minimally and precisely as possible):
It can be reproduced by running the demo program。
https://github.com/rnben/dubbo-demo/blob/master/README.md
Anything else we need to know?:
All the other information is there:https://github.com/rnben/dubbo-demo
The text was updated successfully, but these errors were encountered: