Code review comment for ~cgrabowski/maas:fix_connections_dict_update_while_updating_connection_count

Revision history for this message
Christian Grabowski (cgrabowski) wrote :

> Your patch probably fixes the traceback. But I'd like to understand a bit what
> is actually modifying the dictionary?
>
> I wonder if we have another problem here, and we're only fixing the symptoms.
> I did run the test you added, but that doesn't seem to trigger the problem.

So the test does pass without the fix _most_ of the time, but so what's happening is `registerWorkerRPC` is being called at the same time as `update`, the way I was able to reproduce this is having a region controller running for awhile, and then restarting the rack controller in a loop, so it has some (or at least previous) connectivity, and new connections are being added at the same time. This becomes more apparent when running with multiple threads and rpc workers, which is a bit difficult to express in the test. So by copying the dict, the original / main connections dict can receive the new connections, while updating the DB based on the copied dict.

« Back to merge proposal