Open nazar-pc opened 9 months ago
This log message is visible so that we learn about unforeseen situations. Known-harmless errors are masked out explicitly. This error is unexpected: Quinn will only permit connection attempts to IPv6 peers if the endpoint itself is bound to an IPv6 address. If your environment is IPv4 only, then the endpoint should not have been able to bind to an IPv6 address.
What address is the endpoint bound to? What precise operation prompts the error?
Applications or even end users that aren't interested in debugging unexpected behavior have the option of configuring tracing
to filter out quinn_udp logs regardless, but that has its own risks.
My local application doesn't have IPv6 networking and doesn't have ability to connect to IPv6 nodes. However, some nodes on P2P network do have IPv6.
In libp2p nodes share addresses with each other, including sharing IPv6 addresses with IPv4-only nodes because they have no idea if those are IPv4-only or not.
My expectation is that Rust libraries only log critical errors that should never happen and are bugs, the rest should be bubbled up to application that is using the library to decide what to do with it. So far quinn-udp is the only library I consistently see logging things that are not bugs and are 100% expected.
For example here is another one that I suspect might be happening on IPv6-enabled machines:
WARN quinn_udp: sendmsg error: Os { code: 10051, kind: NetworkUnreachable, message: "A socket operation was attempted to an unreachable network." }, Transmit: { destination: [240e:390:2431:eac0:e8db:3de1:1205:e147]:30433, src_ip: None, enc: Some(Ect0), len: 1200, segment_size: None }
While I do agree it is possible to tweak log level, current situation is very annoying for two reasons:
error
for this libraryinfo
level results in very reasonable logging, quinn-udp
is the only exception that every user downstream will have to become aware of and tweak to something like info,quinn_udp=error
by default, which is undesirableIn libp2p nodes share addresses with each other, including sharing IPv6 addresses with IPv4-only nodes because they have no idea if those are IPv4-only or not.
Okay, but that doesn't answer my questions. Quinn should not permit connection attempts from an IPv4 endpoint to IPv6 peers. Again, what address is the endpoint bound to? What precise operation prompts the error?
My expectation is that Rust libraries only log critical errors that should never happen and are bugs
As described above, this situation should never happen and looks like a bug. That said, if you only want to see errors, why isn't your log filter set to error level?
For example [ENETUNREACH] is another one that I suspect might be happening on IPv6-enabled machines
This is an interesting example. While we'd like to bubble such conditions up, it's not clear if there's a good way to do so more than we already do: failing a connection outright is probably wrong, because this condition can be transient due to a device's network configuration changing. For example, a connection attempt on a mobile device shouldn't fail immediately because you just turned off wifi and the cellular modem hasn't finished spinning up.
There's a case for logging ENETUNREACH at debug level, but this seems like exactly the sort of information you'd want a non-expert user to find in a log file if they're having connectivity issues due to an incorrectly configured environment.
Okay, but that doesn't answer my questions. Quinn should not permit connection attempts from an IPv4 endpoint to IPv6 peers. Again, what address is the endpoint bound to? What precise operation prompts the error?
My understanding is that the following happens:
This is in a P2P network and I am a user of a libp2p library and utilize Quinn indirectly. So that is my understanding of the workflow, but it might be incorrect.
There's a case for logging ENETUNREACH at debug level, but this seems like exactly the sort of information you'd want a non-expert user to find in a log file if they're having connectivity issues due to an incorrectly configured environment.
Probably, I'm not yet sure about how widespread this one is, have not seen it on the machines I managed yet, but we do have other indications of network issues in P2P environment like total number of connections and other metrics, so from user's point of view printing these sporadically it non-actionable most of the time.
same issue sendmsg error: Os { code: 99, kind: AddrNotAvailable, message: "Cannot assign requested address" }, Transmit: { destination: [2001:620:610:808:e8c2:d427:f4f8:f202]:30433, src_ip: None, enc: Some(Ect0), len: 1200, segment_size: None }
Hey @Ralith, does my explanation above sound plausible? I'd like to help make some progress on this one in the near future.
I'm interested in the answers to the specific, concrete questions I asked. Attempts to connect across address family shouldn't get this far, and we can't fix whatever issue is causing it without details. To reiterate:
I'm not categorically opposed to reducing the error severity, but it seems to me that the current severity is working as intended in bringing issues like this to our attention.
@kpp or @mxinden, would either of you be able to help with above questions since you have way more context into how things are used in libp2p?
I'm observing these messages in libp2p-based app:
This is just IPv6 address on IPv4-only machine, which is nothing special or problematic really, it should be up to the app to log it or not. However,
quinn-udp
logs it automatically.What do you think about decreasing "sendmsg error" to
debug
ortrace
level?