-
Notifications
You must be signed in to change notification settings - Fork 992
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
ConcurrentModificationException iterating over partitions #1252
Comments
or possibly this use case should have been querying from |
The node-selection API now uses the read-only view instead of the mutable partitions view when consuming the topology view.
The node-selection API now uses the read-only view instead of the mutable partitions view when consuming the topology view.
The node-selection API now uses the read-only view instead of the mutable partitions view when consuming the topology view.
Thanks for the report. The described approach is exactly what we need to do here. |
That's fixed now. |
Bug Report
I'm calling the
readonly
method on an async commands instance to select some nodes and hit a ConcurrentModificationException. It looked like a topology refresh happened at the same time and modified the partitions. Looking into the code,Partitions.getPartitions
offers up access to its internal list of partitions (which is otherwise synchronized on in all internal methods), but client code that callsgetPartitions
is not protected. TheStaticNodeSelection
constructor calls this method and iterates over the list can potentially result in this issue when the list changes. Consider using a CopyOnWriteArrayList or some other mechanism so that clients of thegetPartitions
call can safely iterate over the list.Current Behavior
Stack trace
Environment
The text was updated successfully, but these errors were encountered: