adutra commented on code in PR #4487:
URL: https://github.com/apache/polaris/pull/4487#discussion_r3267390571


##########
runtime/service/src/main/java/org/apache/polaris/service/events/listeners/inmemory/InMemoryBufferEventListener.java:
##########
@@ -63,7 +63,13 @@ public class InMemoryBufferEventListener extends 
PolarisPersistenceEventListener
   @Override
   protected void processEvent(String realmId, PolarisEvent event) {
     var processor = Objects.requireNonNull(processors.get(realmId));
-    processor.onNext(event);
+    // Reactive Streams rule 1.3 requires onNext() to be called sequentially. 
Mutiny's
+    // UnicastProcessor is not safe for concurrent onNext() calls; concurrent 
emissions
+    // can silently drop events. Synchronize on the processor so that 
concurrent
+    // processEvent() calls for the same realm serialize on the same 
underlying processor.
+    synchronized (processor) {

Review Comment:
   Oh excellent @nandorKollar !! I actually was a bit surprised myself that I 
forgot the `synchronize` block around the `onNext()` call, but your finding 
actually explains everything.
   
   @visit2rahul I'm sorry for the confusion I introduced, but I think as per 
@nandorKollar findings, we don't need the changes in this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to