A resource that is shared by two threads through a named mutex object is not shared as expected in Windows Server 2003 (889318)
The information in this article applies to:
- Microsoft Windows Server 2003, Web Edition
- Microsoft Windows Server 2003, Standard Edition
- Microsoft Windows Server 2003, Enterprise Edition
- Microsoft Windows Server 2003, Datacenter Edition
- Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
- Microsoft Windows Server 2003, Datacenter Edition for Itanium-based Systems
SYMPTOMSIn Microsoft Windows Server 2003, a resource that is being shared by two threads through a named mutex object is not shared as expected. A second named mutex object is created instead, and both the original named mutex object and the new named mutex object use the same resource. This issue may occur when the following conditions are true: - A named mutex object is opened and closed repeatedly.
- The named mutex object has the same name every time that it is opened.
CAUSEThis issue occurs when the following conditions are true: - Two or more threads repeatedly open and close a named mutex object.
- Two or more threads open and close a named mutex object at the same time.
- Two or more threads each open and close a named mutex object that has the same name.
When all these conditions are true, the information about the named mutex object may be mismatched in the object-management process. Note This issue is more likely to occur on a multiprocessor computer. This issue occurs if a program uses the following procedure to open or to create a named mutex object: - The program calls the OpenMutex function to open the named mutex object.
- If the OpenMutex function does not run correctly and if the return code is NULL, the program operates as if the named mutex object does not exist.
- Because the program operates as if the named mutex object does not exist, the program calls the CreateMutex function.
- The named mutex object is created.
WORKAROUNDTo work around this issue, call the CreateMutex function instead of the OpenMutex function. If the named mutex object does not exist, the
CreateMutex function creates a new named mutex object. However, if the named mutex object does exist, the CreateMutex function returns a handle to the named mutex object.
Typically, the Initialize function of a program creates a named mutex object that has the same name every time that the named mutex object is created. This named mutex object is closed when the program ends.
Therefore, if your program must repeatedly open, create, and then close a named mutex object, use the CreateMutex function instead of the OpenMutex function.STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Microsoft is researching this problem and will post more information in this article when the information becomes available.
Modification Type: | Major | Last Reviewed: | 12/3/2004 |
---|
Keywords: | kbtshoot kbprb KB889318 kbAudDeveloper |
---|
|