horner commented on issue #1355: URL: https://github.com/apache/cordova-ios/issues/1355#issuecomment-3132973067
### Problem It appears that when I background the Cordova app and use another application on iOS that uses lots of memory, when I return to the Cordova app it shows a white screen and appears to be frozen. There is no way to reload the page or navigate so I’m forced to kill the app and relaunch. Captured the White Screen of Death in the debugger: Here is a short: https://youtube.com/shorts/4rV0T_peIew?si=U60VhrfND7t9yftR <img width="1392" height="897" alt="Image" src="https://github.com/user-attachments/assets/0813b19f-1646-4117-bf74-cd9f7303d61b" /> ``` CDVWebViewEngine shouldReloadWebView:: CDVWebViewEngine shouldReloadWebView title: Stress-Energy Tensor Inquiry - Ozwell CDVWebViewEngine shouldReloadWebView location: http://localhost:12992/session/sjrSNPmbYmHHkyAvb CDVWebViewEngine shouldReloadWebView reload: 0 Clock discrepancy detected. Attempting re-sync. Connection timeout. No sockjs heartbeat received. HMR: websocket closed HMR: connected 0x115002300 - GPUProcessProxy::didClose: 0x115002300 - GPUProcessProxy::gpuProcessExited: reason=Crash 0x115009230 - [PID=14401] WebProcessProxy::gpuProcessExited: reason=Crash Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}> 0x1150112b0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=14400, error: (null) Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d6be0 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d5680 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} 0x11500ce30 - NetworkProcessProxy::didClose (Network Process 0 crash) Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process 14402 does not exist" UserInfo={NSLocalizedFailureReason=Specified target process 14402 does not exist}> 0x115011550 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=14402, error: (null) Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d4300 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d66a0 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} 0x115009230 - [PID=14401] WebProcessProxy::didClose: (web process 0 crash) 0x115009230 - [PID=14401] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process 14401 does not exist" UserInfo={NSLocalizedFailureReason=Specified target process 14401 does not exist}> 0x115011730 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=14401, error: (null) 0x12add5518 - [pageProxyID=19, webPageID=20, PID=14401] WebPageProxy::processDidTerminate: (pid 14401), reason=Crash 0x12add5518 - [pageProxyID=19, webPageID=20, PID=14401] WebPageProxy::dispatchProcessDidTerminate: reason=Crash Could not create a sandbox extension for '/var/containers/Bundle/Application/DBE77A25-7CC7-4636-90F7-1D5BC6558BFC/Ozwell.app' Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d7240 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d7a20 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} IAB.close() called but it was already closed. Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d5380 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d7a80 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x12c5d7b10 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}} CDVWebViewEngine shouldReloadWebView:: CDVWebViewEngine shouldReloadWebView title: CDVWebViewEngine shouldReloadWebView location: http://localhost:12992/session/sjrSNPmbYmHHkyAvb CDVWebViewEngine shouldReloadWebView reload: 0 CDVWebViewEngine shouldReloadWebView:: CDVWebViewEngine shouldReloadWebView title: CDVWebViewEngine shouldReloadWebView location: http://localhost:12992/session/sjrSNPmbYmHHkyAvb CDVWebViewEngine shouldReloadWebView reload: 0 CDVWebViewEngine shouldReloadWebView:: CDVWebViewEngine shouldReloadWebView title: CDVWebViewEngine shouldReloadWebView location: http://localhost:12992/session/sjrSNPmbYmHHkyAvb CDVWebViewEngine shouldReloadWebView reload: 0 CDVWebViewEngine shouldReloadWebView:: CDVWebViewEngine shouldReloadWebView title: CDVWebViewEngine shouldReloadWebView location: http://localhost:12992/session/sjrSNPmbYmHHkyAvb CDVWebViewEngine shouldReloadWebView reload: 0 CDVWebViewEngine shouldReloadWebView:: CDVWebViewEngine shouldReloadWebView title: CDVWebViewEngine shouldReloadWebView location: http://localhost:12992/session/sjrSNPmbYmHHkyAvb CDVWebViewEngine shouldReloadWebView reload: 0 App is being debugged, do not track this hang Hang detected: 1.17s (debugger attached, not reporting) attempted to start async task 'Fetch Current User Activity' for RequestID(13003:5 = 55847459749893) but already 1036.96 ms past deadline Handle connection with error: Connection interrupted ``` Here is the debugger: <img width="828" height="801" alt="Image" src="https://github.com/user-attachments/assets/7f11d0f2-07fe-4689-a044-6bf392f20be1" /> ### Research on other people having the issue There is an issue in meteor: https://github.com/meteor/meteor/issues/11811 which mentions the cordova ticket https://github.com/apache/cordova-ios/pull/1235 which mentions a fix: https://github.com/apache/cordova-ios/pull/1533/files by modifying CDVWebViewEngine.m: ``` NSURL* url = [((CDVViewController*) self.viewController) appUrl]; NSURLRequest* appReq = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0]; [self loadRequest:appReq]; ``` In the meteor ticket: [banjerluke](https://github.com/banjerluke) mentioned: Unzip this folder and place it in cordova-build-override/platforms/ios in your project and Meteor will use the patched files when building the app: https://github.com/user-attachments/files/20534411/CordovaLib.zip The end result should be two files in these paths: ``` cordova-build-override/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m cordova-build-override/platforms/ios/CordovaLib/Classes/Public/CDVViewController.h ``` ### Our attempted fix We tried the cordova-build-override/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m file from https://github.com/user-attachments/files/20534411/CordovaLib.zip but that still did not fix it. ### The actual fix We need to detect in the CDVWebViewEngine.m when the GPUProcessProxy Crashes and reload the WebView. We fixed it in our code, but using the override and fixing it to reload when the title is null or empty. This has fixed the issue. We are making a PR to make sure this is fixed for everyone. I think this is an Apple bug, but Cordova is severely unstable for those that get into low memory conditions on their phone… Isn't that everyone? We started PR here: https://github.com/apache/cordova-ios/pull/1552 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org