JooHyukKim commented on code in PR #20242: URL: https://github.com/apache/pulsar/pull/20242#discussion_r1186864159
########## pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java: ########## @@ -2153,9 +2153,14 @@ private CompletableFuture<Void> seekAsyncInternal(long requestId, ByteBuf seek, MessageIdAdv originSeekMessageId = seekMessageId; seekMessageId = (MessageIdAdv) seekId; - duringSeek.set(true); + + if (!duringSeek.compareAndSet(false, true)) { + log.warn("[{}][{}] Attempting to seek operation that is already in progress, cancelling {}", + topic, subscription, seekBy); + seekFuture.cancel(true); Review Comment: > Also, this is a local future, that I believe you can complete it properly (@michaeljmarshall shall we complete with null or exception here?) instead of call cancel. By refering to @michaeljmarshall mentions in [his original issue](https://github.com/apache/pulsar/issues/19671#:~:text=I%20expect%20the%20client%20to%20either%20cancel%20the%20first%20operation%20or%20to%20fail%20the%20second%20operation%20due%20to%20an%20illegal%20call.), I agree that completing with `null` makes more sense? -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org