1. Qpid
  2. QPID-4330

windows clients hang or fault on exit (static destructors)


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.16, 0.18
    • Fix Version/s: 0.19
    • Component/s: C++ Client
    • Labels:
    • Environment:



      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.


        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        12d 9h 12m 1 Cliff Jansen 02/Oct/12 05:26
        Resolved Resolved Closed Closed
        300d 13h 27m 1 Justin Ross 29/Jul/13 18:53
        Justin Ross made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Cliff Jansen made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Cliff Jansen added a comment -
        Cliff Jansen added a comment - fixed r1392093. See https://reviews.apache.org/r/7179/
        Cliff Jansen created issue -


          • Assignee:
            Cliff Jansen
            Cliff Jansen
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: