mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #2127] Additional error context #894
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#894
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @andrewbaxter on GitHub (Jan 13, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2127
Is your feature request related to a problem? Please describe.
I'm calling a method in the library and it returns
proto error: io error: invalid input parameter- AFAICT this is a core io error, and as this is a networking library I believe it's probably making io calls all over the place. I don't have enough details to identify the cause on my own.Describe the solution you'd like
Maybe additional context could be added to the error type? Ex when wrapping IoError a static string describing what was going on at the time. If there's a lot of layers this too might not narrow down the context enough, but it'd be a start...
Since there's a lot of indirection here (resolver layers, pools, etc) I think ideally there'd be that much more context in the error messages.
Obviously performant error handling makes difficult tradeoffs, but right now I think there's too little context in bubbled errors.
Describe alternatives you've considered
Running a debugger. Unfortunately this is in an environment where it's hard to attach a debugger.
Debug-build only print statements? Or something that could be optionally enabled in debug builds? To print out everything it's doing.
@andrewbaxter commented on GitHub (Jan 13, 2024):
I just found the
backtracefeature inproto- I guess the idea is that would provide context in debug builds. I actually went through the documentation before posting this and didn't see it mentioned anywhere.It adds debug information to error objects when
RUST_BACKTRACE=1, both{}and{:?}. I don't know if this is debug builds only.That said, I just tried it and the backtrace dies in the middle of async land:
Perhaps this is an internal error, but I feel like it should say something like "error trying to call
connect" or something that could tie it to the a specific call or point in the source.@andrewbaxter commented on GitHub (Jan 13, 2024):
It looks like there actually is context associated with
io::Error, but it's discarded when converted toProtoError(onlykindis kept).@djc commented on GitHub (Jan 15, 2024):
I think I looked into this once, and std actually doesn't provide APIs to keep the context around?
@andrewbaxter commented on GitHub (Jan 18, 2024):
Oops, my brain purged my cache. I'm trying to remember what I found when I was digging in...
std::io::Errorwraps an error in addition to theKind, exError::new(ErrorKind::Other, "oh no!"). Looking at the docs I think this may be exposed byinto_inner?In this case I believe the error conversion path was
io::Error->ProtoErrorKind->ProtoErrorwhich discards the inner error... I think there were any other error conversions before it was returned.It looks like the standard library mostly uses
const_io_error!macro which is exposed in.description(). Edit:descriptionis deprecated and it says to useDisplaymethods now.But in any case the more context that could be preserved (and possibly supplemented) in
ProtoErrorthe easier it'd make troubleshooting.@andrewbaxter commented on GitHub (Sep 1, 2024):
FWIW I'm now getting
proto error: io error: connection refusedand I see the tls connection traffic both ways over the net so I know the dot upstream isn't refusing the connection, and I don't have an inkling where to start looking for where this error occurred.@cpu commented on GitHub (Sep 1, 2024):
I made some progress here w/ https://github.com/hickory-dns/hickory-dns/pull/2181 and in
0.25.0-alpha.2ProtoErrorKindmaintains the inner error.Are you testing w/ 0.24.x?
@andrewbaxter commented on GitHub (Sep 1, 2024):
Oh awesome!! That's great to hear!
Yeah, while looking into status of the rulstls dep + 0.25 I stumbled upon https://github.com/hickory-dns/hickory-dns/issues/2066 . Trying the
"native-certs"feature now to see if that helps.