You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple threads can invoke publishSubjectController.onNext(event) based on real time data from network.
The consumer buffer keeps growing over 2-3 hours, eventually occupying 99% of the heap and crashing the application.
There is a difference of 1 million between producerIndex and consumerIndex, and roughly those many elements are present in consumer buffer. But the difference grows, indicating that consumption has been stopped for some reason under certain circumstances. Nothing seems to be written to the database.
The behaviour is highly sporadic, the same code works more often than not. Memory leak doesnt happen everytime
Could you please help me with finding an explanation of this behaviour?
The text was updated successfully, but these errors were encountered:
Is your publishSubjectController serialized? Concurrent onNext access can lead to hangs or leaks.
groupBy may hold open groups longer than anticipated, especially if the source has some form of rolling-grouping.
Calling subscribe in forEach is a code smell as it breaks the chain. That can also cause leaks as those are no longer part of the same sequence to be automatically cleaned up.
Its not serialized. Mainly because of high throughput requirement (and like I mentioned, this code worked well until very recently - maybe broken now due to increased load). I was able to simulate hang due to non-serialized publishsubject (under a much higher load and thread count), but it does not create consumer buffer bloating.
There is no rolling-grouping. The incoming data can belong to 1 of 4 groups/topics (with a fairly similar probability). But, even then, are grouped elements cached in consumer buffer ?
Point taken. I ll move the buffering+filtration to a flatmap.
If you call onNext concurrently, you must serialize the subject.
toFlowable(BackpressureStrategy.BUFFER) has an unbounded buffer so if you can't drain it fast enough in downstream operators, it can lead to buffer bloat on its own. You'll have to rethink the dataflow, to use Flowables and some form of bounded data generation.
I have noticed a strange behavior while using rxjava with below code snippet
version : 2.1.12
Multiple threads can invoke publishSubjectController.onNext(event) based on real time data from network.
There is a difference of 1 million between producerIndex and consumerIndex, and roughly those many elements are present in consumer buffer. But the difference grows, indicating that consumption has been stopped for some reason under certain circumstances. Nothing seems to be written to the database.
The behaviour is highly sporadic, the same code works more often than not. Memory leak doesnt happen everytime
Could you please help me with finding an explanation of this behaviour?
The text was updated successfully, but these errors were encountered: