Possible deadlock in custom applications while trying to load dll's

Article ID: 2009703 - View products that this article applies to.
Expand all | Collapse all

Summary

The problem occurs with applications while one thread is reading from the stdin and another thread which tries to load a DLL and tries to get hold of that handle (inherited).

This stack you typically see if you analyze your hang using debugging tools.

kernel32!GetFileType
comctl32!_ioinit
comctl32!_CRT_INIT
comctl32!_DllMainCRTStartup
ntdll!LdrpCallInitRoutine
ntdll!LdrpRunInitializeRoutines
ntdll!LdrpLoadDll
ntdll!LdrLoadDll

 

More Information

You can't have more than one IO (GetStdHandle counts as "IO") on the same synchronous file object. It is a race condition as to whether the child process will call GetFileType() called before the parent gets back to its ReadFile().

GetFileType() is another form of IO, just like ReadFile() and WriteFile(). This is
because the IO system just doesn't know what the file type is; it has to ask the
file system itself.

So if there is synchronous IO already pending (such as a ReadFile/Writefile) on another
thread, GetFileType() will block until that first IO completes.

There were in-depth design changes for the GetFileType implemenation in Vista, so this kind of hang will not be seen in newer Operating Systems.

 

Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Properties

Article ID: 2009703 - Last Review: January 13, 2010 - Revision: 2.0
APPLIES TO
  • Microsoft Windows XP Professional
  • Microsoft Windows XP Service Pack 1
  • Microsoft Windows XP Service Pack 2
  • Microsoft Windows XP Service Pack 3
  • Microsoft Windows Server 2003 Service Pack 1
  • Microsoft Windows Server 2003 Service Pack 2
Keywords: 
KB2009703

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com