Changeset 250329 in webkit
- Timestamp:
- Sep 24, 2019 6:56:50 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250328 r250329 1 2019-09-24 Chris Dumez <cdumez@apple.com> 2 3 [iOS] Regression(r249703) frequent 'kill() returned unexpected error' log messages 4 https://bugs.webkit.org/show_bug.cgi?id=202173 5 6 Reviewed by Geoffrey Garen. 7 8 The kill(pid, 0) command actually fails with an EPERM error when there is a process 9 running with the given pid, and this is causing us to log a lot of errors. The good 10 news is that we merely want to know that there is no process with the given PID and 11 we correctly get a ESRCH error in this case. I renamed the function from 12 isRunningProcessPID() to wasTerminated() and only check for ESRCH error now. I no 13 longer log any error otherwise since this is expected. 14 15 Also, for performance reason, I no longer call kill(pid, 0) from inside 16 AuxiliaryProcessProxy::state() as it gets called a lot. I instead only call it from 17 AuxiliaryProcessProxy::wasTerminated() and call it from 18 WebProcessPool::tryTakePrewarmedProcess(). 19 20 * UIProcess/AuxiliaryProcessProxy.cpp: 21 (WebKit::AuxiliaryProcessProxy::state const): 22 (WebKit::AuxiliaryProcessProxy::wasTerminated const): 23 (WebKit::AuxiliaryProcessProxy::isRunningProcessPID): Deleted. 24 * UIProcess/AuxiliaryProcessProxy.h: 25 * UIProcess/WebProcessPool.cpp: 26 (WebKit::WebProcessPool::tryTakePrewarmedProcess): 27 1 28 2019-09-24 Christopher Reid <chris.reid@sony.com> 2 29 -
trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
r250110 r250329 112 112 return AuxiliaryProcessProxy::State::Launching; 113 113 114 // There is sometimes a delay until we get the notification from mach about the connection getting closed. 115 // To help detect terminated process earlier, we also check that the PID is for a valid running process. 116 if (!m_connection || !isRunningProcessPID(processIdentifier())) 114 if (!m_connection) 117 115 return AuxiliaryProcessProxy::State::Terminated; 118 116 … … 120 118 } 121 119 122 bool AuxiliaryProcessProxy::isRunningProcessPID(ProcessID pid) 123 { 120 bool AuxiliaryProcessProxy::wasTerminated() const 121 { 122 switch (state()) { 123 case AuxiliaryProcessProxy::State::Launching: 124 return false; 125 case AuxiliaryProcessProxy::State::Terminated: 126 return true; 127 case AuxiliaryProcessProxy::State::Running: 128 break; 129 } 130 131 auto pid = processIdentifier(); 124 132 if (!pid) 125 return false;133 return true; 126 134 127 135 #if PLATFORM(COCOA) 128 // Use kill() with a signal of 0 to check if there is actually still a process with the given PID. 129 if (!kill(pid, 0)) 130 return true; 131 132 if (errno == ESRCH) { 133 // No process can be found corresponding to that specified by pid. 134 return false; 135 } 136 137 RELEASE_LOG_ERROR(Process, "kill() returned unexpected error %d", errno); 138 return true; 136 // Use kill() with a signal of 0 to make sure there is indeed still a process with the given PID. 137 // This is needed because it sometimes takes a little bit of time for us to get notified that a process 138 // was terminated. 139 return kill(pid, 0) && errno == ESRCH; 139 140 #else 140 UNUSED_PARAM(pid); 141 return true; 141 return false; 142 142 #endif 143 143 } -
trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h
r250110 r250329 100 100 State state() const; 101 101 bool isLaunching() const { return state() == State::Launching; } 102 bool wasTerminated() const; 102 103 103 104 ProcessID processIdentifier() const { return m_processLauncher ? m_processLauncher->processIdentifier() : 0; } … … 125 126 virtual void connectionWillOpen(IPC::Connection&); 126 127 virtual void processWillShutDown(IPC::Connection&) = 0; 127 static bool isRunningProcessPID(ProcessID);128 128 129 129 struct PendingMessage { -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r250321 r250329 808 808 // There is sometimes a delay until we get notified that a prewarmed process has been terminated (e.g. after resuming 809 809 // from suspension) so make sure the process is still running here before deciding to use it. 810 if (m_prewarmedProcess-> state() == AuxiliaryProcessProxy::State::Terminated) {810 if (m_prewarmedProcess->wasTerminated()) { 811 811 RELEASE_LOG_ERROR(Process, "Not using prewarmed process %d because it has been terminated", m_prewarmedProcess->processIdentifier()); 812 812 m_prewarmedProcess = nullptr;
Note: See TracChangeset
for help on using the changeset viewer.