Skip to content

[BUG] potential ConcurrentModificationException when removeQueue #1197

@HScarb

Description

@HScarb

Describe the bug

public void removeQueue(AmqpQueue queue) {
queues.remove(queue);
if (exchangeType == Type.Direct) {
for (Map.Entry<String, Set<AmqpQueue>> entry : bindingKeyQueueMap.entrySet()) {
bindingKeyQueueMap.computeIfPresent(entry.getKey(), (k, v) -> {
v.remove(queue);
if (v.isEmpty()) {
return null;
}
return v;
});
}
}
updateExchangeProperties();
deleteCursor(queue.getName());
}

in removeQueue method, we remove value from a map when iterating it, which cause potential ConcurrentModificationException.

To Reproduce
bind queue with Direct exchange, then remove the queue

Expected behavior
queue removed successfully

Screenshots
none

Additional context
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions