-
-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
Step 1. Spawn RabbitMQ instance docker run -d -p 15672:15672 -p 5672:5672 -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest --name rabbitmq rabbitmq:management
Step 2. Run script
Step 3. Run docker restart rabbitmq
Step 4. Wait for recovery (it will be... forever)
Isn't feature is stabilized and tested before? If so, why it is not reconnecting, or ?
[dependencies]
tokio = { version = "1", features = ["full"] }
futures = "0"
lapin = "4"
tracing-subscriber = "0"use std::time::Duration;
use lapin::{BasicProperties, ConnectionProperties, options::BasicPublishOptions};
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let conn_properties = ConnectionProperties::default().enable_auto_recover();
let conn = lapin::Connection::connect("amqp://localhost:5672/%2f", conn_properties)
.await
.unwrap();
let channel = conn.create_channel().await.unwrap();
loop {
println!("Status: {:?}", channel.status());
if let Err(error) = channel
.basic_publish(
Default::default(),
"queue".into(),
BasicPublishOptions::default(),
"Hello, world!".as_bytes(),
BasicProperties::default(),
)
.await
{
if let Err(error) = channel.wait_for_recovery(error).await {
println!("Error: {:?}", &error);
}
}
tokio::time::sleep(Duration::from_secs(1)).await;
}
}Enabled tracing spamming such logs (many thousands)
2026-02-25T15:16:19.756724Z TRACE io_loop: lapin::io_loop: io_loop run
2026-02-25T15:16:19.756728Z TRACE io_loop: lapin::io_loop: io_loop do_run can_read=true can_write=true has_data=false
2026-02-25T15:16:19.756732Z TRACE io_loop: lapin::io_loop: Should continue? status=Initial connection_status=Reconnecting internal_rpc_empty=true frames_pending=false conn_killed=true ser_frames_empty=true
2026-02-25T15:16:19.756739Z ERROR io_loop: lapin::io_loop: Socket was readable but we read 0. This usually means that the connection is half closed, thus report it as broken.
2026-02-25T15:16:19.756743Z TRACE io_loop: lapin::io_loop: We're in the process of recovering connection, quit reading socket to enter recovery
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels