I'm writing a program with many simultaneous goroutines doing mmaps and munmaps, and ran into this problem.
We hold a lock on the handleMap while we remove an addr/handle
pair from it, but we need to also include the UnampViewOfFile in
the map. There was a window of opportunity for the OS to re-use
the addr for a new map, and if the goroutine which mapped that addr
also unmapped it before we tried to remove our handle from
handleMap, we would find that our handle was missing from handleMap.
I'm writing a program with many simultaneous goroutines doing mmaps and munmaps, and ran into this problem.
We hold a lock on the handleMap while we remove an addr/handle pair from it, but we need to also include the UnampViewOfFile in the map. There was a window of opportunity for the OS to re-use the addr for a new map, and if the goroutine which mapped that addr also unmapped it before we tried to remove our handle from handleMap, we would find that our handle was missing from handleMap.