⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243528 in webkit


Ignore:
Timestamp:
Mar 26, 2019, 4:54:11 PM (7 years ago)
Author:
Chris Dumez
Message:

[macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
https://bugs.webkit.org/show_bug.cgi?id=196277
<rdar://problem/49127581>

Reviewed by Alex Christensen.

When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
thread. Other auxiliary processes such as the NetworkProcess would end up calling
platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
unreliable as demonstrated by the test app attached to the radar.

Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.

  • Shared/AuxiliaryProcess.cpp:
  • Shared/Cocoa/AuxiliaryProcessCocoa.mm:

(WebKit::AuxiliaryProcess::platformStopRunLoop):

  • Shared/ios/AuxiliaryProcessIOS.mm:

(WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.

  • Shared/mac/AuxiliaryProcessMac.mm:

(WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.

Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243524 r243528  
     12019-03-26  Chris Dumez  <cdumez@apple.com>
     2
     3        [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
     4        https://bugs.webkit.org/show_bug.cgi?id=196277
     5        <rdar://problem/49127581>
     6
     7        Reviewed by Alex Christensen.
     8
     9        When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
     10        to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
     11        thread. Other auxiliary processes such as the NetworkProcess would end up calling
     12        platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
     13        makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
     14        macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
     15        unreliable as demonstrated by the test app attached to the radar.
     16
     17        Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
     18        see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
     19        patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
     20
     21        * Shared/AuxiliaryProcess.cpp:
     22        * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
     23        (WebKit::AuxiliaryProcess::platformStopRunLoop):
     24        * Shared/ios/AuxiliaryProcessIOS.mm:
     25        (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
     26        * Shared/mac/AuxiliaryProcessMac.mm:
     27        (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
     28
    1292019-03-26  Keith Rollin  <krollin@apple.com>
    230
  • trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp

    r241169 r243528  
    175175}
    176176
    177 #if !PLATFORM(IOS_FAMILY)
     177#if !PLATFORM(COCOA)
    178178void AuxiliaryProcess::platformStopRunLoop()
    179179{
  • trunk/Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm

    r243324 r243528  
    2828
    2929#import "WKCrashReporter.h"
     30#import "XPCServiceEntryPoint.h"
    3031#import <wtf/cocoa/Entitlements.h>
    3132
     
    4344}
    4445
     46void AuxiliaryProcess::platformStopRunLoop()
     47{
     48    XPCServiceExit(WTFMove(m_priorityBoostMessage));
    4549}
     50
     51}
  • trunk/Source/WebKit/Shared/ios/AuxiliaryProcessIOS.mm

    r240683 r243528  
    114114}
    115115
    116 void AuxiliaryProcess::platformStopRunLoop()
    117 {
    118     XPCServiceExit(WTFMove(m_priorityBoostMessage));
    119 }
    120 
    121116} // namespace WebKit
    122117
  • trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm

    r243253 r243528  
    696696#endif
    697697
    698 #if PLATFORM(IOSMAC)
    699 void AuxiliaryProcess::platformStopRunLoop()
    700 {
    701     XPCServiceExit(WTFMove(m_priorityBoostMessage));
    702 }
    703 #endif
    704 
    705698void AuxiliaryProcess::setQOS(int latencyQOS, int throughputQOS)
    706699{
Note: See TracChangeset for help on using the changeset viewer.