reactor-addons icon indicating copy to clipboard operation
reactor-addons copied to clipboard

TopicProcessor (Critical): onNext makes out of RingBuffer capacity after some time without subscribers

Open mayras opened this issue 5 years ago • 0 comments

Make TopicProcessor with size of RingBuffer equals 1024 and start to call topicProcessor.onNext without subscribers, when RingBuffer will be full try to subscribe to topicProcessor and you will get nothing. It's not normal behaviour, (RingBuffer.Sequence minimum) must follow to cursor of RingBuffer to avoid such situations. Next code of TopicProcessor makes problem (from line 314) when it starts from minimum which is -1 when first subscriber comes:

//bind eventProcessor sequence to observe the ringBuffer

//if only active subscriber, replay missed data
if (incrementSubscribers()) {

	signalProcessor.sequence.set(minimum.getAsLong());
	ringBuffer.addGatingSequence(signalProcessor.sequence);
	//set eventProcessor sequence to minimum index (replay)
}

Reactor Core version 3.2.8.RELEASE

JVM version (e.g. java -version) 1.8.0_171

mayras avatar May 07 '19 01:05 mayras