pulsar-rs icon indicating copy to clipboard operation
pulsar-rs copied to clipboard

BUG,consumer.rs:872:29 attempt to subtract with overflow,

Open zhengxingjian opened this issue 4 years ago • 4 comments

`

      self.remaining_messages -= message
                            .payload
                            .as_ref()
                            .and_then(|payload| {
                                println!("len {} {:?}",self.remaining_messages,payload.metadata.num_messages_in_batch);
                                payload.metadata.num_messages_in_batch
                            })
                            .unwrap_or(1i32)
                            as u32;

` When a large number of messages are consumed, they can be reproduced by sending tens of thousands of messages in a few seconds, and the log outputs data:len 610 Some(1000),610-1000 as u32 overflow

zhengxingjian avatar Mar 01 '22 07:03 zhengxingjian

@zhengxingjian Could you explain in detail how to reproduce this issue?

DonghunLouisLee avatar Jun 08 '22 02:06 DonghunLouisLee

If the batch_size used by producer is not smaller than the batch_size in consumer, the lib might panic in above position.

For example:

  • send in 10, receive in 1000 => it works.
  • send in 1000, receive in 100 => boom!

zhengcan avatar Nov 15 '23 02:11 zhengcan

Please ref the test project: https://github.com/zhengcan/pulsar-rs-issue-194

zhengcan avatar Nov 15 '23 03:11 zhengcan