fix(context): load Keys under the mutex in Copy (#4854)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Copy read c.Keys before RLock. Set stores that field under Lock when the map is created. The race detector reports the unsynchronized access, and the copy can observe a nil header and drop keys Set has already published. maps.Clone(nil) returns nil, so the load and the clone belong in the same critical section. Map iteration was already under the mutex.
authored by HazyLab · committed by GitHub · parent 3b08cd7 · Browse files · 2 files+25 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: hazyhaar <hazyhaarlabs@gmail.com>
Diff stats
2 files+25 added−2 removed
- other:+25 added−2 removed