Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tarpc freezes/shuts off after a few days of uptime #538

@TAINCER

Description

@TAINCER

When tarpc is running for a longer time, after a while, each call with an existing client return the connection to the server was already shutdown, on all clients and new clients can't connect anymore, only after a server restart.

I don't know what causes this, but it generally happens after a few days of server uptime. I use this purely internally, not exposing the port beyond the machine, only to communicate from a linux host into multiple windows VM's.

This is the server impl:

async fn start_tarpc_server() -> Result<()> {
    let mut listener = tarpc::serde_transport::tcp::listen(
        (
            IpAddr::V4(Ipv4Addr::UNSPECIFIED),
            env::var("NODE_PORT")?.parse()?,
        ),
        Json::default,
    )
    .await?;
    info!("Listening on port {}", listener.local_addr().port());
    listener.config_mut().max_frame_length(usize::MAX);
    listener
        // Ignore accept errors.
        .filter_map(|r| future::ready(r.ok()))
        .map(server::BaseChannel::with_defaults)
        .map(|channel| {
            let server = SupervisorServer(channel.transport().peer_addr().unwrap());
            channel.execute(server.serve()).for_each(spawn)
        })
        .buffer_unordered(usize::MAX)
        .for_each(|_| async {})
        .await;

    Ok(())
}

I'm also trying to get more metrics/logging into this to monitor how many are connected, etc. but that's still running and I have to wait until it freezes again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions