congbobo184 commented on code in PR #18928:
URL: https://github.com/apache/pulsar/pull/18928#discussion_r1049324152


##########
pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawReaderImpl.java:
##########
@@ -203,12 +232,17 @@ public CompletableFuture<Void> seekAsync(MessageId 
messageId) {
 
         @Override
         public CompletableFuture<Void> closeAsync() {
+            CompletableFuture<Void> closeFuture = super.closeAsync();
             reset();
-            return super.closeAsync();
+            return closeFuture;

Review Comment:
   `closeAsync` and `messageReceived` don't in the same thread run and have no 
locks. so the message also can be added in incomingRawMessages after it has 
been closed
   
   step : 
   1. thread-1 `messageReceived` check the state is ready.
   
https://github.com/apache/pulsar/pull/18928/files#diff-2d41ea4027219e13a0a942edc54352bb0a997060112705796d1d811213d585f3R245
   2.  thread-2 `closeAsync()` the RawReaderImpl state change to close and 
reset the incomingRawMessages
   
https://github.com/apache/pulsar/pull/18928/files#diff-2d41ea4027219e13a0a942edc54352bb0a997060112705796d1d811213d585f3R245
   3. thread-1 `messageReceived`  continue to run the add operation
   
https://github.com/apache/pulsar/pull/18928/files#diff-2d41ea4027219e13a0a942edc54352bb0a997060112705796d1d811213d585f3R252
   



-- 
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