• Bruce Dawson's avatar
    Fix fiber-induced shutdown crash · 38ec02f7
    Bruce Dawson authored
    Chrome uses fibers to increase the size of its main thread's stack and
    this was found to cause shutdown crashes in some cases, deep inside
    msctf.dll and coremessage.dll. It turns out that avoiding these is as
    simple as deleting the fibers before quitting.
    
    There is still concern that these crashes were being missed, and it may
    be time to start exiting with TerminateProcess (which also solves the
    problem) but that is for another day.
    
    Aside: the proper cleanup functions for ConvertThreadToFiberEx and
    CreateFiberEx are not documented on MSDN and it is not obvious that they
    actually use different cleanup functions. The official examples don't
    bother cleaning up, but luckily this sample does:
    
    https://devblogs.microsoft.com/oldnewthing/20200602-00/?p=103819
    
    Testing showed that it was the ::DeleteFiber call which was needed to
    avoid the shutdown crash, but both cleanup function calls were retained.
    
    Bug: 981238, 1141408
    Change-Id: Ifb3d4dc4d0ea8728e203e654c53f105fca615c02
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2493664
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#820285}
    38ec02f7
chrome_exe_main_win.cc 13.7 KB