Is it legal to produce events from the background consumer thread using ProducerType.MULTI?
See original GitHub issueI’m trying to debug an issue where the queue appears to be full, but my background thread is in runnable
state spinning on at com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:190)
without making any progress. I’m curious if there’s a memory safety issue when the consumer thread adds elements to the queue, but I don’t see this mentioned in the documentation.
The issue is odd because the background thread never appears to do a great deal of processing, and the queue grows slowly over time as through the state has become lost.
Any information or ideas are greatly appreciated, thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (23 by maintainers)
Top Results From Across the Web
Event-based multithread producer-consumer? - Stack Overflow
I am new in C# and do not have a strong background with event handling. c# · multithreading · events · producer-consumer ·...
Read more >LMAX Disruptor User Guide
The LMAX Disruptor is a high performance inter-thread messaging library. ... Multicast events to consumers, with consumer dependency graph.
Read more >Kafka 3.3 Documentation
The Producer API to publish (write) a stream of events to one or more Kafka topics. The Consumer API to subscribe to (read)...
Read more >Multi-Threaded Messaging with the Apache Kafka Consumer
When implementing a multi-threaded consumer architecture, it is important to note that the Kafka consumer is not thread safe.
Read more >Red Hat AMQ 2021.q3 Using AMQ Streams on RHEL
Scaling data consumption using consumer groups ... MBeans matching kafka.producer:type=producer-topic-metrics,client-id=*,topic=* 7.7.
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 Free
Top 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
Been thinking on this over the weekend. Haven’t got any answers, but a few more questions.
It seems odd that we constantly pick up the read thread on the line from a closing brace. That seems like an unlikely outcome to me. What is that thread doing? Appending log messages to…somewhere? I’d expect to find the thread somewhere in client code rather than spinning in
BatchEventProcessor
- if repeated stack traces always find us at that closing brace, that is interesting.Actions:
If I trust that stack trace, this has the feeling of a resource bottleneck hurting the read thread in some way more than a memory visibility issue. If we’d found the read thread blocking on something near the sequence classes, I’d be more tempted towards the latter.
On that note - is it worth attempting to create a test program that simulates the usage of this ringbuffer, potentially with a smaller buffer/higher input rate to see if this is reproducible? That might give us a bit more hope 😃
Hello, I am having the exact same issue. Very hard to reproduce and it is happening rarely (every 6 months) , but when it does it is a big problem for me. Publisher is reporting full buffer , but on the other side the reader is happily spinning not picking any new events. I am also into a multi producers , single consumer scenario. Not sure if it is going to help solve this problem but it is a problem that shows up on another system.
“pool-2-thread-17” #56 prio=5 os_prio=0 tid=0x000055d4a02d4800 nid=0x3e2a1 waiting on condition [0x00007f72dcad6000] : java.lang.Thread.State: TIMED_WAITING (parking) : at sun.misc.Unsafe.park(Native Method) : at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:338) : at com.lmax.disruptor.SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:92) : at com.lmax.disruptor.SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:65) : at com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56) : at com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:159) : at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125) : at java.lang.Thread.run(Thread.java:748)