
13 Apr
2007
13 Apr
'07
9:06 p.m.
Interprocess, shared memory, bug & patch. Bug: A race condition exists if a shared memory segment is being created/initialized for the first time. Another attempt to open the shared memory segment concurrently results in the second process waiting for the creator to complete the initialization. When the initialization is complete the second attempt will promptly throw an interprocess_exception (corrupted_error). Fix: The patch solution is to wait for the memory segment to not be in the InitializingSegment or UninitializedSegment states. At this point if the state is anything other than InitializedSegment then throw the interprocess_exception. A proposed patch is attached.