dotcloud/docker — pull request #3606 by jpallen (2014-01-15 17:38:34+00:00)
Title: Add RWMutex lock into TruncIndex to fix race condition when inserting values

The idx.index array is overwritten when a new value is inserted to the index.
When two containers are created concurrently, their ids are inserted to the
index and one can overwrite the other leaving one of ids missing from the
index. Adding a RWMutex lock around read/write operations fixes this.

This should solve issue #1319.

I tried and failed to write a failing automated test for this. I'm still getting my head around the docker test suite and how to run an individual test. If this needs a test to be merged I'll have another look.