[Bug] BatchConsumerPolicy violation

Aperta
#617 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, python

Direzione di ricerca

The report concerns batch receive on a partitioned Pulsar topic, where a batch policy with max_num_message=400 and timeout=-1 hangs while timeout=50ms does not. Start by reproducing the stall with a partitioned topic and a batch receive loop, then trace how the batch policy's count and timeout conditions are evaluated in the C++ client. Done means batch_receive returns after 400 messages and no longer blocks indefinitely when the timeout is disabled.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Search before asking
  • I searched in the issues and found nothing similar.
Version

OS: Debian GNU/Linux
version 11 (Bullseye)

pulsar version 3.0.13

Minimal reproduce step

Use pulsar-client python library 3.1.0

initialise a BatchConsumerPolicy on n different partitions of the same topic with timeout = -1 , max_num_bytes = -1, max_num_message = 400

and then subscribe to partitions with this policy and begin consuming using batch_receive() method

What did you expect to see?

Expected that the consumption of messages from any partition will happen normally (wait for the max num and then return)

What did you see instead?

It was observed that the batch_receive() method got permanently stuck after a few days. Restarting the python program mitigated the issue. Another python program running a different subscription on the same topic with BatchConsumerPolicy(max_num_message=-1,max_num_bytes=-1,timeout=1second) ran perfectly without any issues and the topic was such that there would be 0 produce at most a few minutes in a couple of days. Whenever the first process got stuck, the second one never got stuck. The first one got stuck at seemingly irregular patterns but definitely eventually.

Another point to note is that this was the only difference between both of them.

Following this observation I changed the BatchConsumerPolicy from BatchConsumerPolicy(max_num_message=400,max_num_bytes=-1,timeout=-1) to BatchConsumerPolicy(max_num_message=-1,max_num_bytes=-1,timeout=50ms) and then that process never got stuck (3 months in now)

Anything else?

I suspect that max_num_messages and max_num_bytes are treated at the same priority as per
https://pulsar.apache.org/api/python/3.0.x/pulsar.ConsumerBatchReceivePolicy.html

but timeout is at a lower priority which might cause some deadlock

Are you willing to submit a PR?
  • I'm willing to submit a PR!
Lingua principale
C++
Stelle
72
Fork
93
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/pulsar-client-cpp

Tutte le issue di apache/pulsar-client-cpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.