poorbarcode commented on PR #15051: URL: https://github.com/apache/pulsar/pull/15051#issuecomment-1092436056
> > > Seems that this PR only enhances the exception handling. Could you provide more information on how this PR fixed the duplicated consumer issue? > > > > > > The key point for the problem was "possibly delete a running CompletableFuture", the logic of the original code was not rigorous enough. this PR solved it. > > I was wondering about the same thing whether this is just a refactoring. This does fix a race condition in providing the error message. It's possible the the CompletableFuture completes after it has been checked. In that case, the old code might have provided a wrong error code. > > @poorbarcode I don't think that this PR prevents duplicated consumers. Could you explain how it achieves that? @lhotari This PR fixed that : When things go wrong with consumer operations, duplicated consumers registry. You can reproduce the problem like this (The code is in the attachment): - Override ConsumerImpl.java by acttachment file. These change will Execute command-Subscribe more times in a short time - Overide ServerCnx.java by acttachment file. These change controls the execution order of multiple threads, increasing the probability of problems to 100% - Add SubscribeProcessController.java. It is multi thread execution-order-controller [ConsumerImpl.java.txt](https://github.com/apache/pulsar/files/8448567/ConsumerImpl.java.txt) [ServerCnx.java.txt](https://github.com/apache/pulsar/files/8448568/ServerCnx.java.txt) [SubscribeProcessController.java.txt](https://github.com/apache/pulsar/files/8448569/SubscribeProcessController.java.txt) -- 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]
