Cliff Jansen created QPID-4330:
----------------------------------

             Summary: windows clients hang or fault on exit (static destructors)
                 Key: QPID-4330
                 URL: https://issues.apache.org/jira/browse/QPID-4330
             Project: Qpid
          Issue Type: Bug
          Components: C++ Client
    Affects Versions: 0.18, 0.16
         Environment: Windows
            Reporter: Cliff Jansen
            Assignee: Cliff Jansen
             Fix For: 0.19


Windows clients occasionally fail to terminate cleanly after exit() or return 
from main().  I have examined a large number of stack traces, mostly gibberish 
presumably from rogue memory writes some time in the past.  Two refreshingly 
clear traces showed failure when direct or indirect threading calls were made 
from inside a static destructor: ~IOThread and ~WinSockSetup.

If a DLL (shared object) is winding up due to the library being unloaded 
(FreeLibrary), the DLL code has an obligation to clean up resources that could 
leak, and since the process hasn't exited, existing threads live on and 
threading primitives are trustworthy.   In this case the Windows library may 
(and should) follow the Linux clean up logic in its static destructors.

If the DLL is winding up due to exit() (or return from main()), it is undefined 
how quickly other threads will be forcefully terminated.  Locks may be held 
indefinitely or falsely released (changed in the Vista time frame).  In this 
case, any fancy footwork is dangerous.  The best course of action is to let the 
OS clean up things it would anyway, i.e. do nothing if possible.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to