-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix adding message to list potential issue #14377
Conversation
(cherry picked from commit b22445f)
(cherry picked from commit b22445f)
(cherry picked from commit b22445f)
@@ -1907,18 +1907,17 @@ protected void completeOpBatchReceive(OpBatchReceive<T> op) { | |||
return CompletableFuture.completedFuture(Collections.emptyList()); | |||
} | |||
List<MessageIdData> data = new ArrayList<>(messageIds.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are seem another potential race condition, use ArrayList
in possible multithread
scenario is unsafe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've create #14687 to continue this discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes.
Motivation
There may exist potential issue when adding MessageIdData into
data
, because when the future is triggered, thedata
object was not guarantee to be already filled in.Documentation
no-need-doc