-
Notifications
You must be signed in to change notification settings - Fork 2.5k
make error message more reasonable #2591
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
Conversation
@vmihailenco please help to cr this code, this pr will be real helpful to let developer know what the timeout reason if they missed config the PoolSize parameter. |
I'm sorry, I didn't understand specifically what issue you are describing.... |
shortly speaking, when you set timeout smaller then the PoolTimeout, redis may report But if redis library report |
I don't believe modifying the error message would be beneficial. in fact, it could potentially mislead users. |
@monkey92t maybe you can reference the implementation of context.WitDeadline, the related doc is:
In our case, return And for my case, return connection pool timeout is very helpful to indicate the need to increase pool size. Or maybe we can study the sql package's method to expose the time wait problem to users:
The WaitDuration is the total wait time for connections, user can report the metrics to prometheus to detect connection count problems. |
We have recently encountered other issues related to timeouts, and it is possible that we may change our logic for timeouts and command reading/writing. |
Look at the following code snippet:
output for the code snippet with this pr:
When QPS become very high, rdb.Get may return error with the old logic:
context deadline exceeded
which is very confusing and hard to lookup the real problem.
In this pr, i referenced the implementation of context.WithTimeout, to use the smaller duration of configed timeout and timeout in current context. by doing this, the error will be
redis: connection pool timeout
, so users will know why timeout occurred.