cordova-plugin-webview-proxy icon indicating copy to clipboard operation
cordova-plugin-webview-proxy copied to clipboard

[BUG] Possible memory leak causing web view reload when downloading large files (images and videos) through the proxy

Open fortinmike opened this issue 3 years ago • 0 comments
trafficstars

When our app starts, it fetches a lot of images and videos, about 100-200 MB total, in one go. While this occurs (only when proxying requests using cordova-plugin-webview-proxy), native app memory usage goes up, then the web view crashes and reloads when it reaches a certain point (~120-160 MB).

Here is the native console log output that appears when this occurs:

2021-12-14 12:24:27.381203-0500 App[2436:466287] [Process] 0x102cc8c00 - [PID=2447] WebProcessProxy::didClose: (web process 0 crash)
2021-12-14 12:24:27.381296-0500 App[2436:466287] [Process] 0x102cc8c00 - [PID=2447] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=4
2021-12-14 12:24:27.381361-0500 App[2436:466287] [ProcessSuspension] 0x102cf81e0 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid
2021-12-14 12:24:27.381517-0500 App[2436:466287] [Process] 0x15883c418 - [pageProxyID=11, webPageID=12, PID=2447] WebPageProxy::processDidTerminate: (pid 2447), reason 4
2021-12-14 12:24:27.385477-0500 App[2436:466287] [Loading] 0x15883c418 - [pageProxyID=11, webPageID=12, PID=2447] WebPageProxy::dispatchProcessDidTerminate: reason=4
2021-12-14 12:24:27.387126-0500 App[2436:467004] [ProcessSuspension] 0x102cf81e0 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=0, error: (null)
2021-12-14 12:24:27.392717-0500 App[2436:467004] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2021-12-14 12:24:27.392875-0500 App[2436:467004] [ProcessSuspension] 0x102cf8240 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=2447, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}

Seems like the proxy is leaking something, but I'm not sure what at the moment. Any ideas?

To Reproduce

  1. Fetch some amount of large files using the proxy
  2. Watch memory usage
  3. Memory constantly goes up until the web view reloads

Expected behavior Not leaking / reloading.

fortinmike avatar Dec 14 '21 17:12 fortinmike