Skip to content

Commit

Permalink
GH-1613: Fix Race in Producer Factory
Browse files Browse the repository at this point in the history
Resolves #1613

Do not clear the cache in `destroy()` - just drain the producer queues instead.
Fixes a race condition where a producer could be returned to the cache between draining
the queues and clearing the map.
Just leave the queue(s) in place to accept new returns.

**cherry-pick to 2.5.x, 2.4.x, 2.3.x, 1.3.x**

(cherry picked from commit 7ad38c0)
  • Loading branch information
garyrussell authored and artembilan committed Nov 9, 2020
1 parent fb1977c commit e815ace
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ public void destroy() {
next = queue.poll();
}
});
this.cache.clear();
synchronized (this.consumerProducers) {
this.consumerProducers.forEach(
(k, v) -> v.closeDelegate(this.physicalCloseTimeout, this.listeners));
Expand Down

0 comments on commit e815ace

Please sign in to comment.