-
Notifications
You must be signed in to change notification settings - Fork 126
Better error log when dialing without internet connection #5466
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
|
Same as other PRs: Would there be any significant performance improvement if we use the |
the error returned when the user has no internet and all three connection types fail is "context deadline exceeded; context deadline exceeded; mDNS query failed to find a candidate" which all individually don't have an error type. I also believe context deadline exceeded is returned from an external package, so would have to check it coming in if its that error with strings.Contains() and then make it into a Viam error type anyways? unless there is another way to do it |
|
would prefer the change to be made where the error is getting returned, so in goutils in the dial function. There it'll be easier to use errors.Is |
connectWithLock() seems to be calling dial() once for webRTC and then once for gRPC, so not sure how to make the changes in dial() when we want both dial() attempts to have the contextDeadlineExceeded before we return "failed to connect to robot within time limit". I did make the change to use Errors.is() on dial returns though. |
|
for example, we can have As it is, I think we're only checking that one out of the possibly three bundled errors is a context deadline exceeded error, which would be incorrect |
|
talked offline - go clients makes a second dial if the first dial fails. the first dial already (unintentionally) swallows the mDNS timeout, which was why I was a bit confused. I think it makes sense to make the change here instead of a combination of both goutils and rdk, but to make sure that the err is deadline exceeded, and grpcErr comprises of both deadline exceeded and mDNS query failed to find a candidate |
robot/client/client.go
Outdated
| } | ||
|
|
||
| // instead of returning two context.DeadlineExceeded errors, tell the user how to fix | ||
| if errors.Is(err, context.DeadlineExceeded) && errors.Is(grpcErr, context.DeadlineExceeded) && errors.Is(grpcErr, rpc.ErrMDNSQuery) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrMDNSQuery gets exported with my matching goutils changes
|
tested again and got error message: |
robot/client/client.go
Outdated
| // connection and that the machine is on. This should be more helpful than simply returning a chain of context.DeadlineExceeded | ||
| // and candidate not found errors. | ||
| const connTimeoutURL = "https://docs.viam.com/dev/tools/common-errors/#conn-time-out" | ||
| if errors.Is(err, context.DeadlineExceeded) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should do this check before we combine the errors in L538
cheukt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
oops sorry I rerequested review |
Old error:
2025-11-10T22:55:40.444Z ERROR client gosdk/gosdk.go:28 context deadline exceeded; context deadline exceeded; mDNS query failed to find a candidatenew error:
2025-11-11T16:13:31.449Z ERROR client gosdk/gosdk.go:28 failed to connect to robot within time limit. check network connection and try again. see http://docs.viam.com/dev/tools/common-errors/#conn-time-out for troubleshooting steps.note: this only changes CLI and Go SDK logs, as other SDKs have their own conn logic
note2: currently no viam link system to shorten links so itll stay long