Skip to content
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

Autonat: Uvi PermissionDenied len > max when encoding error #5059

Open
Tracked by #4524
Firaenix opened this issue Jan 7, 2024 · 1 comment
Open
Tracked by #4524

Autonat: Uvi PermissionDenied len > max when encoding error #5059

Firaenix opened this issue Jan 7, 2024 · 1 comment
Labels

Comments

@Firaenix
Copy link

Firaenix commented Jan 7, 2024

Summary

I've just wired up Autonat in some of my systems and have started seeing this error.

I'm not sure where the Uvi max length is being set in config and as far as I can see, it only affects serialisation.

image

I have set up a separate libp2p project with an autonat client dialling over either TCP or QUIC to the same server, it seems that first connects if I have just restarted the server but as more and more load reaches the server, we start seeing this issue on the client side.

impl ProxyBehaviour {
    pub fn new(
        keypair: &libp2p::identity::Keypair,
        relay_client: libp2p::relay::client::Behaviour,
    ) -> Result<Self> {
        let identify = identify::Behaviour::new(identify::Config::new(
            "/proxy/1.0.0/".into(),
            keypair.public(),
        ));

        let connection_limits =
            libp2p::connection_limits::Behaviour::new(ConnectionLimits::default());

        let autonat = libp2p::autonat::Behaviour::new(
            keypair.public().to_peer_id(),
            libp2p::autonat::Config::default(),
        );

        Ok(Self {
            identify,
            ping: ping::Behaviour::new(
                ping::Config::new()
                    .with_timeout(Duration::from_secs(60))
                    .with_interval(Duration::from_secs(600)),
            ),
            connection_limits,
            relay_client,
            autonat,
            dcutr: dcutr::Behaviour::new(keypair.public().to_peer_id()),
            kademlia: kad::Behaviour::new(
                keypair.public().to_peer_id(),
                MemoryStore::new(keypair.public().to_peer_id()),
            ),
        })
    }
}
...
pub fn create_swarm() -> Result<ProxySwarm> {
    let swarm = libp2p::SwarmBuilder::with_new_identity()
        .with_tokio()
        .with_tcp(
            tcp::Config::default().port_reuse(true).nodelay(true),
            noise::Config::new,
            yamux::Config::default,
        )?
        .with_quic()
        .with_dns()?
        .with_relay_client(noise::Config::new, yamux::Config::default)?
        .with_behaviour(|keypair, relay_client| {
            ProxyBehaviour::new(keypair, relay_client).unwrap()
        })?
        .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(60)))
        .build();

    Ok(ProxySwarm { swarm })
}

Expected behavior

An autonat outbound probe should be sent, resulting in a peer attempting to dial me.

Actual behavior

I get an error, causing NAT discovery to fail

OutboundProbe(Error { probe_id: ProbeId(1010), peer: Some(PeerId("...")), error: OutboundRequest(Io(Custom { kind: PermissionDenied, error: "len > max when encoding" })) })

Relevant log output

No response

Possible Solution

No response

Version

No response

Would you like to work on fixing this bug ?

Maybe

@thomaseizinger
Copy link
Contributor

Thank you for the report! We are currently working on AutonatV2: #4524

I unfortunately don't have any capacity to look into bugs of v1 but I'd merge PR(s) that fix any as long as they are accompanied with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants