Code Monkey home page Code Monkey logo

Comments (4)

andrewbaxter avatar andrewbaxter commented on May 25, 2024

I just found the backtrace feature in proto - 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:

 0: <hickory_proto::error::ProtoError as core::convert::From<E>>::from
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/hickory-proto-0.24.0/src/error.rs:359:24
 1: core::ops::function::FnOnce::call_once
		   at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
 2: <T as futures_util::fns::FnOnce1<A>>::call_once
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/fns.rs:15:9
 3: <futures_util::fns::MapErrFn<F> as futures_util::fns::FnOnce1<core::result::Result<T,E>>>::call_once::{{closure}}
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/fns.rs:219:25
 4: core::result::Result<T,E>::map_err
		   at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:829:27
 5: <futures_util::fns::MapErrFn<F> as futures_util::fns::FnOnce1<core::result::Result<T,E>>>::call_once
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/fns.rs:219:9
 6: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/map.rs:57:73
 7: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/lib.rs:91:13
 8: <futures_util::future::try_future::MapErr<Fut,F> as core::future::future::Future>::poll
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/lib.rs:91:13
 9: <core::pin::Pin<P> as core::future::future::Future>::poll
		   at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/future/future.rs:125:9
10: <core::pin::Pin<P> as core::future::future::Future>::poll
		   at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/future/future.rs:125:9
11: futures_util::future::future::FutureExt::poll_unpin
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/future/future/mod.rs:558:9
12: <hickory_proto::xfer::dns_multiplexer::DnsMultiplexerConnect<F,S,MF> as core::future::future::Future>::poll
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/hickory-proto-0.24.0/src/xfer/dns_multiplexer.rs:241:32
13: <hickory_proto::xfer::dns_exchange::DnsExchangeConnectInner<F,S,TE> as core::future::future::Future>::poll
		   at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/hickory-proto-0.24.0/src/xfer/dns_exchange.rs:322:27
14: futures_util::future::future::FutureExt::poll_unpin

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.

from hickory-dns.

andrewbaxter avatar andrewbaxter commented on May 25, 2024

It looks like there actually is context associated with io::Error, but it's discarded when converted to ProtoError (only kind is kept).

from hickory-dns.

djc avatar djc commented on May 25, 2024

I think I looked into this once, and std actually doesn't provide APIs to keep the context around?

from hickory-dns.

andrewbaxter avatar andrewbaxter commented on May 25, 2024

Oops, my brain purged my cache. I'm trying to remember what I found when I was digging in...

std::io::Error wraps an error in addition to the Kind, ex Error::new(ErrorKind::Other, "oh no!"). Looking at the docs I think this may be exposed by into_inner?

In this case I believe the error conversion path was io::Error -> ProtoErrorKind -> ProtoError which 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: description is deprecated and it says to use Display methods now.

But in any case the more context that could be preserved (and possibly supplemented) in ProtoError the easier it'd make troubleshooting.

from hickory-dns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.