We observe a few exceptions in our system while iterating over
getCachedChanges [1]. This is caused by multithreaded appending new
changes to the change cache. In order to prevent this exception we
need to make lists from the values which are safe to iterate even if
the backing dict gets updated. While we're at it fix it for all other
drivers as well.
[1] Trace:
2020-03-06 12:39:51,429 ERROR zuul.GerritEventConnector: Exception moving Gerrit event:
Traceback (most recent call last):
File "/opt/zuul/lib/python3.6/site-packages/zuul/driver/gerrit/gerritconnection.py", line 284, in run
self._handleEvent()
File "/opt/zuul/lib/python3.6/site-packages/zuul/driver/gerrit/gerritconnection.py", line 243, in _handleEvent
self._getChange(event)
File "/opt/zuul/lib/python3.6/site-packages/zuul/driver/gerrit/gerritconnection.py", line 277, in _getChange
refresh=True, event=event)
File "/opt/zuul/lib/python3.6/site-packages/zuul/driver/gerrit/gerritconnection.py", line 742, in _getChange
self._updateChange(change, event, history)
File "/opt/zuul/lib/python3.6/site-packages/zuul/driver/gerrit/gerritconnection.py", line 820, in _updateChange
self.sched.onChangeUpdated(change, event)
File "/opt/zuul/lib/python3.6/site-packages/zuul/scheduler.py", line 1703, in onChangeUpdated
for other_change in source.getCachedChanges():
RuntimeError: dictionary changed size during iteration
Change-Id: I30396997441c7e7756bfb81be708389d6331bf19