Help: Non deterministic behavior between producers and consumers
See original GitHub issueExample code:
def test_one(timeout, sleep):
consumer = KafkaConsumer('test.test_one', group_id=None,
bootstrap_servers='localhost:9093')
producer = KafkaProducer(bootstrap_servers='localhost:9093')
producer.send('test.test_one', b'test_one')
time.sleep(sleep)
p = consumer.poll(timeout)
print p
return p == {}
Sometimes the consumer sees the message sent by the producer, sometimes it doesn’t. A non python consumer sees every message sent by the producer, so it is not kafka itself that is the issue, rather it is something in the consumer. sleep was added on the thinking that it could be timing related to poll too soon after the message was sent, but does not seem to have made any impact for a variety of sleep durations, same with adjusting the poll timeout duration.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How to Avoid the Headache With Non-deterministic Bugs in ...
Typically, non-deterministic behavior is caused by three things: lack ... Your customers can be the first to spot a problem in a production...
Read more >Trying to achieve deterministic behavior on recovery/rewind ...
Hey Roger, To add onto Chris's discussion we put some thought from early on into how to get exact semantics in Samza.
Read more >Exactly-Once Semantics Are Possible: Here's How Kafka Does It
At-least-once semantics: if the producer receives an acknowledgement (ack) from the Kafka broker and acks=all, it means that the message has been written ......
Read more >Kafka : Producers-Consumers & Partitions - Dev Genius
Understanding partitions,Consumers helps you learn Kafka faster. here we discuss about behaviour of Kafka's ... USE CASE 3:No of partitions=no of consumers.
Read more >HELP! Ebean shows non deterministic behavior
In our code we do this over 10000 entries and sometimes we the City is null, sometimes the name of the Customer. If...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
producer.send is asynchronous by default; you should do something like this if you want a delivery guarantee
producer.send('test.test_one', b'test_one').get(timeout)
or just callproducer.flush()
.Have you also verified that your consumer.poll() is not hitting the timeout? If it is unable to fetch records before the timeout, it will return {}
i was also using latest and it caused issues for me as fetcher was in loop forever. When i used earliest it helped me.