lapin
lapin copied to clipboard
error PRECONDITION-FAILED: PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out.
I proceed with the long running task with the message queue. However, after about 2 hours, the consumer channel ends with an error message. What's the cause?
error: AMQP soft error: PRECONDITION-FAILED: PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out.
Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more
my code
for message in consumer {
match message {
Ok((_, delivery)) => {
let input = String::from_utf8_lossy(&delivery.data).into_owned();
info!("#{} receive message str: {}", idx, input);
if let Err(e) = futures_lite::future::block_on(async { delivery.ack(BasicAckOptions::default()).await }) {
error!("{}", e) // <<- here
}
...
Can you try with some extra logging?
Please log a timestamp right before your match (e.g. when you just got the message), then in your async block in block_on, before the ack and after the ack ?
And/or maybe you can retry with RUST_LOG=debug or trace?
Usually this happens when spawning tasks with e.g. thread::spawn instead of task::spawn