On Tue, Mar 15, 2011 at 04:01:35PM -0400, Charles Wilson wrote: >On 3/15/2011 3:07 PM, Christopher Faylor wrote: >> On Tue, Mar 15, 2011 at 06:34:27PM +0000, Jon TURNEY wrote: >>> >>> I've come across a problem whilst trying to run the twisted test suite, >>> where >>> some tests just cause python to segfault. It seems to be the same issue >>> with >>> libcrypto as reported in [2],[3] > >>Actually you aren't supposed to be able to call anything you like here >>and it isn't clear why a POSIX/UNIX/Linux program would be relying on >>DllMain. > >There are cases where cygwin-ish code does win32-ish things, like >login.exe, or the PyWin32 extensions for Python-on-Windows(and cygwin). >Maybe twisty uses PyWin32?
The python Twisted stuff works on UNIX systems so there should be no reason to use Windows-isms in Cygwin code - especially when the Windows-ism *calls* UNIX code. The ability to get into trouble when you mix Windows stuff like DllMain with Cygwin stuff is very high. >However, it does seem that python (or one of its extensions) is doing >something it shouldn't. > >From http://msdn.microsoft.com/en-us/library/ms682583%28v=vs.85%29.aspx >> The entry-point function should perform only simple initialization >> or termination tasks. It must not call the LoadLibrary or LoadLibraryEx >> function (or a function that calls these functions), because this may >> create dependency loops in the DLL load order. This can result in a DLL >> being used before the system has executed its initialization code. >> Similarly, the entry-point function must not call the FreeLibrary >> function (or a function that calls FreeLibrary) during process >> termination, because this can result in a DLL being used after the >> system has executed its termination code. >> >> Because Kernel32.dll is guaranteed to be loaded in the process >> space when the entry-point function is called, calling functions in >> Kernel32.dll does not result in the DLL being used before its >> initialization code has been executed. Therefore, the entry-point >> function can call functions in Kernel32.dll that do not load other DLLs. >> For example, DllMain can create synchronization objects such as critical >> sections and mutexes, and use TLS. Unfortunately, there is not a >> comprehensive list of safe functions in Kernel32.dll. >> >> Windows 2000: Do not create a named synchronization object in >> DllMain because the system will then load an additional DLL. >> >> Calling functions that require DLLs other than Kernel32.dll may >> result in problems that are difficult to diagnose. For example, >> calling User, Shell, and COM functions can cause access violation >> errors, because some functions load other system components. >> Conversely, calling functions such as these during termination can >> cause access violation errors because the corresponding component may >> already have been unloaded or uninitialized. >> >> Because DLL notifications are serialized, entry-point functions >> should not attempt to communicate with other threads or processes. >> Deadlocks may occur as a result. i.e., "you aren't supposed to be able to call anything you like here" i.e., "you can't do that" cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple