Backport raising of #9731 fixes.
Some changes done to connection_consider_empty_write_buckets
and connection_consider_empty_read_buckets
before the following commits are causing infinite loops in Shadow. The infinite loops are fixed by the following two commits.
96f92f2062118b61a43134170b92001d3be1c128 8f793c38fbcd885d40adf8312ef1767e172e1be4
The latest stable 0.2.4.21 still has infinite loops. I am requesting that those commits get backported to 0.2.4.x to be included in the next 0.2.4.x stable release. They are relatively trivial changes.
Shadow issue for reference: https://github.com/shadow/shadow/issues/201