lapin icon indicating copy to clipboard operation
lapin copied to clipboard

Memory leak when connection fails

Open gjonikas opened this issue 2 years ago • 0 comments

Hi, I believe I've found a memory leak which occurs when lapin fails to establish an amqp connection.

It is possible to reproduce the issue with the code snippet below. The re is no RabbitMQ running on 127.0.0.1:5672, so the connection fails. Retrying to connect in a tight loop makes program's RSS memory grow indefinitely.

This happens with the latest Lapin 2.1.1, but I've initially encountered it with 1.x version.

fn main() {
    futures::executor::LocalPool::new().run_until(async {
        loop {
            let conn = lapin::Connection::connect(
                "amqp://127.0.0.1:5672/%2F?heartbeat=5&connection_timeout=10000",
                lapin::ConnectionProperties::default(),
            )
            .await;
            println!("connection {:#?}", conn);
        }
    });
}

Please let me know if there is any other information I could provide you with.

gjonikas avatar Jun 01 '22 09:06 gjonikas