lapin icon indicating copy to clipboard operation
lapin copied to clipboard

error PRECONDITION-FAILED: PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out.

Open initprism opened this issue 2 years ago • 1 comments

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 
             } 
...

initprism avatar Jan 20 '22 12:01 initprism

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?

Keruspe avatar Jan 30 '22 13:01 Keruspe

Usually this happens when spawning tasks with e.g. thread::spawn instead of task::spawn

Keruspe avatar May 19 '23 19:05 Keruspe