Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a45b3b20b1061b5faa7d063b15cfe93e24e7ee79
      
https://github.com/WebKit/WebKit/commit/a45b3b20b1061b5faa7d063b15cfe93e24e7ee79
  Author: Ben Nham <n...@apple.com>
  Date:   2024-02-22 (Thu, 22 Feb 2024)

  Changed paths:
    M Source/WTF/wtf/MemoryPressureHandler.cpp
    M Source/WTF/wtf/MemoryPressureHandler.h
    M Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm
    M Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp
    M Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp
    M Source/WebKit/WebProcess/WebProcess.cpp

  Log Message:
  -----------
  WebContent process stays in the isUnderMemoryPressure state forever after it 
breaches the PROC_LIMIT_CRITICAL threshold
https://bugs.webkit.org/show_bug.cgi?id=269859
rdar://118126701

Reviewed by Antti Koivisto.

After 244148@main, a WebContent process that exceeds the PROC_LIMIT_CRITICAL 
threshold ends up in
the isUnderMemoryPressure state forever. This is because we were mutating the 
memory pressure state
instance variable when handling the process limit notification. Since the OS 
only notifies you when
you exceed the proc limit, but not when you go back under the proc limit, that 
state variable ended
up staying in the critical state forever. (This bug has occurred before, see 
r234646.)

To fix this, stop mutating the memory pressure state when the process limit 
notification fires, and
add a separate callback for handling process limit notifications.

* Source/WTF/wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setMemoryPressureStatus):
(WTF::MemoryPressureHandler::memoryPressureStatusChanged):
(WTF::MemoryPressureHandler::didExceedProcessMemoryLimit):
* Source/WTF/wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
(WTF::MemoryPressureHandler::setDidExceedProcessMemoryLimitCallback):
(WTF::MemoryPressureHandler::isUnderMemoryWarning const):
(WTF::MemoryPressureHandler::isUnderMemoryPressure const):
* Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
* Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp:
(WTF::MemoryPressureHandler::triggerMemoryPressureEvent):
* Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp:
(WTF::MemoryPressureHandler::windowsMeasurementTimerFired):
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Canonical link: https://commits.webkit.org/275198@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to