cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

Webview is reloaded sometimes and Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog'

Open 75341704 opened this issue 4 years ago • 17 comments

Bug Report

Problem

What is expected to happen?

When app start, it works without reloading the view

What does actually happen?

The webview is reloaded sometimes actually just like refreshing the browser.

Information

2021-04-29 12:31:13.086440+0800 myApp[2320:513802] Apache Cordova native platform version 6.1.0 is starting. 2021-04-29 12:31:13.086490+0800 myApp[2320:513802] Multi-tasking -> Device: YES, App: YES 2021-04-29 12:31:13.126397+0800 myApp[2320:513802] [unspecified] An empty string is not a valid group container identifier. 2021-04-29 12:31:13.126426+0800 myApp[2320:513802] [unspecified] container_create_or_lookup_app_group_path_by_app_group_identifier: client sent invalid parameters 2021-04-29 12:31:13.330186+0800 myApp[2320:513802] The preference key "AllowNewWindows" is not defined and will default to "FALSE" 2021-04-29 12:31:13.331092+0800 myApp[2320:513802] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE" 2021-04-29 12:31:13.332963+0800 myApp[2320:513802] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE" 2021-04-29 12:31:13.332990+0800 myApp[2320:513802] The preference key "Allow3DTouchLinkPreview" is not defined and will default to "TRUE" 2021-04-29 12:31:13.333005+0800 myApp[2320:513802] CDVWebViewEngine will reload WKWebView if required on resume 2021-04-29 12:31:13.333028+0800 myApp[2320:513802] Using WKWebView 2021-04-29 12:31:13.333185+0800 myApp[2320:513802] [CDVTimer][console] 0.020027ms 2021-04-29 12:31:13.333235+0800 myApp[2320:513802] [CDVTimer][handleopenurl] 0.023007ms 2021-04-29 12:31:13.333949+0800 myApp[2320:513802] [CDVTimer][intentandnavigationfilter] 0.695944ms 2021-04-29 12:31:13.334006+0800 myApp[2320:513802] [CDVTimer][gesturehandler] 0.028014ms 2021-04-29 12:31:13.335699+0800 myApp[2320:513802] Currently running release version 2020.06.29-23.05.45 2021-04-29 12:31:13.364688+0800 myApp[2320:513802] [CDVTimer][hotcodepush] 30.660033ms 2021-04-29 12:31:13.364794+0800 myApp[2320:513802] [CDVTimer][inappbrowser] 0.069976ms 2021-04-29 12:31:13.364993+0800 myApp[2320:513802] [CDVTimer][cdvwkwebviewfilexhr] 0.177026ms 2021-04-29 12:31:13.365012+0800 myApp[2320:513802] [CDVTimer][TotalPluginStartup] 31.868935ms 2021-04-29 12:31:13.429313+0800 myApp[2320:513802] WF: === Starting WebFilter logging for process myApp 2021-04-29 12:31:13.429354+0800 myApp[2320:513802] WF: _userSettingsForUser mobile: { filterBlacklist = ( ); filterWhitelist = ( ); restrictWeb = 1; useContentFilter = 0; useContentFilterOverrides = 0; whitelistEnabled = 0; } 2021-04-29 12:31:13.429388+0800 myApp[2320:513802] WF: _WebFilterIsActive returning: NO 2021-04-29 12:31:13.575002+0800 myApp[2320:513937] [tcp] tcp_output [C1.2.1:3] flags=[R.] seq=3168068465, ack=3780910421, win=4032 state=CLOSED rcv_nxt=3780910421, snd_una=3168068465 2021-04-29 12:31:13.635831+0800 myApp[2320:513802] IAB.close() called but it was already closed. 2021-04-29 12:31:14.294749+0800 myApp[2320:513922] Nothing to update 2021-04-29 12:31:14.619787+0800 myApp[2320:513802] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE" ///////////// The webview is reloaded and I got the reoprt hereunder////////////////// 2021-04-29 12:31:26.027519+0800 myApp[2320:513802] [ProcessSuspension] 0x104cde140 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid 2021-04-29 12:31:26.027601+0800 myApp[2320:513802] [Process] 0x12884f018 - [pageProxyID=11, webPageID=12, PID=2323] WebPageProxy::processDidTerminate: (pid 2323), reason 3 2021-04-29 12:31:26.034190+0800 myApp[2320:513802] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}> 2021-04-29 12:31:26.034235+0800 myApp[2320:513802] [ProcessSuspension] 0x104cde180 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 2323, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing} 2021-04-29 12:31:26.040013+0800 myApp[2320:513802] [Loading] 0x12884f018 - [pageProxyID=11, webPageID=12, PID=2323] WebPageProxy::dispatchProcessDidTerminate: reason = 3 2021-04-29 12:31:26.167514+0800 myApp[2320:513802] IAB.close() called but it was already closed. 2021-04-29 12:31:26.803244+0800 myApp[2320:513916] Nothing to update 2021-04-29 12:31:27.043435+0800 myApp[2320:513802] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"

Command or Code

Environment, Platform, Device

Version information

[email protected] with: [email protected] [email protected] [email protected] [email protected]

Environment: OS: darwin Node: v10.16.3 npm: 6.14.9

Plugins: com.lampa.startapp cordova-hot-code-push-plugin-renew cordova-plugin-app-version cordova-plugin-appavailability cordova-plugin-camera cordova-plugin-device cordova-plugin-geolocation cordova-plugin-imagepicker cordova-plugin-inappbrowser cordova-plugin-qr-barcode-scanner cordova-plugin-screen-orientation cordova-plugin-splashscreen cordova-plugin-whitelist cordova-plugin-wkwebview-file-xhr eeschiavo-cordova-plugin-clipboard

iOS platform: Xcode 12.5 Build version 12E262

PS: related Post https://stackoverflow.com/questions/65162287/wkwebview-is-trying-to-run-on-background-although-its-closed-and-should-be-dis

Checklist

  • [ ] I searched for existing GitHub issues
  • [ ] I updated all Cordova tooling to most recent version
  • [ ] I included all the necessary information above

75341704 avatar Apr 29 '21 04:04 75341704

I have the same problem...

Actually my main page loads perfectly. When I navigate to another page with href="" the app starts blinking black and white.

Any ideas here?

Edit 1: I have following plugins in common with you:

  • cordova-plugin-whitelist
  • cordova-plugin-splashscreen (Edit 3: I tried removing this plugin - but it did not help)
  • cordova-plugin-device
  • (cordova-plugin-wkwebview-file-xhr) - I had installed this plugin earlier as well.

Edit 2: Problem occurs on iOS 14.4+ on real device

  • I have only a problem on a real device (iPhone 11 on iOS 14.4 and 14.5) or in Testflight with same device.
  • On the same emulator it does not crash.
  • On real device iPhone 6 on iOS 12.4.9 it works.

Edit 4: here my logs...

[ProcessSuspension] 0x10ecb5e00 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid
[Process] 0x10603f818 - [pageProxyID=11, webPageID=12, PID=6219] WebPageProxy::processDidTerminate: (pid 6219), reason 3
[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>

MarcelSchuermann avatar May 04 '21 14:05 MarcelSchuermann

@75341704 : Could you resolve it or any hints?

MarcelSchuermann avatar May 09 '21 19:05 MarcelSchuermann

@MarcelSchuermann

The problem was found when I checked the previous release of my app (git reset one by one).

In my project, I made an extension of https://github.com/leaflet/leaflet.vectorgrid considering my data format. Three self-defined VectorGrid layers were added to the map and they used same url (The OSS is used for caching in the server side) The VectorGrid is a Tiled-based layer and it will request different tiled-layer's data at the same time in the moved map. After the "same url" was removed, the error was gone.

So the "concurrent requests", I guess , in the WKWebView may cause the error.

75341704 avatar May 09 '21 22:05 75341704

Thanks @75341704 Though, I sadly was not able to resolve it till now. I created a stackoverflow question with some details: https://stackoverflow.com/questions/67571345/ios-iphone-11-flashing-black-and-white-while-browsler-is-constantly-reloading-r

MarcelSchuermann avatar May 17 '21 15:05 MarcelSchuermann

Did somebody resolve this problem?

lesmiserables0 avatar Jun 21 '21 07:06 lesmiserables0

I found the same problem when creating a map in the webview - specifically for me a DeckGL map. Given that @75341704 had problems with leaflet, I think it could be related. It's probably something like a temporary memory/request overload, speaking from absolutely no experience whatsoever.

For now, I've removed the map and it's working fine - I'll be experimenting with different ways to add the map back in (after a time delay etc.)

michaeljelly avatar Aug 27 '21 10:08 michaeljelly

Does anyone have some new results or a new starting point for this? We are facing the same problem when loading 3D Tiles in CesiumJS. So it seems to go in the same direction as the tile based requests described by @75341704.

mschulz-716 avatar Aug 31 '21 06:08 mschulz-716

Facing a similar issue with the native WKWebView with a redirect from a payment provider back to our PWA https://github.com/pwa-builder/pwabuilder-ios/issues/29 - has anyone found out what exactly is happening? It seems to me that this might be caused by restarting the embedded PWA, although we're not using cordova for this but a plain native project generated by pwabuilder it seems to be a shared issue.

ttraenkler avatar Nov 16 '21 22:11 ttraenkler

I have the same problem... 2021-11-29 14:27:03.433556+0800 App[2063:106573] <_UISystemGestureGateGestureRecognizer: 0x10120bcd0>: Gesture: Failed to receive system gesture state notification before next touch 2021-11-29 14:27:03.433645+0800 App[2063:106573] <_UISystemGestureGateGestureRecognizer: 0x101207450>: Touch: Failed to receive system gesture state notification before next touch ⚡️ [log] - IndexBest 2021-11-29 14:27:03.619627+0800 App[2063:106573] [ProcessSuspension] 0x103cc5dc0 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid 2021-11-29 14:27:03.620871+0800 App[2063:106573] [Process] 0x10202da18 - [pageProxyID=6, webPageID=7, PID=2080] WebPageProxy::processDidTerminate: (pid 2080), reason 3 2021-11-29 14:27:03.625604+0800 App[2063:106573] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}> 2021-11-29 14:27:03.625897+0800 App[2063:106573] [ProcessSuspension] 0x103cc5e00 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 2080, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing} 2021-11-29 14:27:03.650084+0800 App[2063:106573] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}> 2021-11-29 14:27:03.650179+0800 App[2063:106573] [ProcessSuspension] 0x103cc5e80 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 2080, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing} 2021-11-29 14:27:03.650321+0800 App[2063:106573] [Loading] 0x10202da18 - [pageProxyID=6, webPageID=7, PID=2080] WebPageProxy::dispatchProcessDidTerminate: reason = 3 2021-11-29 14:27:03.651018+0800 App[2063:106573] [Process] 0x10202da18 - [pageProxyID=6, webPageID=7, PID=2080] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts 2021-11-29 14:27:03.657020+0800 App[2063:106573] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Suspended" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}> 2021-11-29 14:27:03.657157+0800 App[2063:106573] [ProcessSuspension] 0x103cc5ec0 - ProcessAssertion: Failed to acquire RBS Suspended assertion 'WebProcess Suspended Assertion' for process with PID 2080, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Suspended" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}

datahoecn avatar Nov 29 '21 15:11 datahoecn

@michaeljelly @mschulz-716 @ttraenkler

When I optimize the performance of web request related to the wms serivce, there are lots of "queueing or stalled" in chrome "Timing". Due to map app, there are a lot of synchronous requests for the tile resource. If tile resources are all from the same host, it reaches browser connection limitations occasionally. The "queueing or stalled" occurs and then the timeout or broken, I guess, may happened in the wkwebview.

The problem herein may caused by "browser connection limitations".

There are some related urls hereunder for your reference. https://docs.pushtechnology.com/cloud/latest/manual/html/designguide/solution/support/connection_limitations.html https://blog.bluetriangle.com/blocking-web-performance-villain http://blog.lightstreamer.com/2013/01/on-ios-url-connection-parallelism-and.html https://github.com/Lightstreamer/utility-ThreadPool-ios

So try to add different hosts for the same resource such as tile1.yourserver.com tile2.yourserver.com tile3.yourserver.com tile4.yourserver.com tile5.yourserver.com ... instead of one "tile.yourserver.com"

75341704 avatar Dec 18 '21 04:12 75341704

Something new here?

danielehrhardt avatar Apr 19 '22 10:04 danielehrhardt

There is the same problem on Vue Ionic App v5.

It appears when user is closing ionic page with played html video tag.

ildar-dev avatar May 26 '22 22:05 ildar-dev

2021-11-29 14:27:03.619627+0800 App[2063:106573] [ProcessSuspension] 0x103cc5dc0 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid 2021-11-29 14:27:03.620871+0800 App[2063:106573] [Process] 0x10202da18 - [pageProxyID=6, webPageID=7, PID=2080] WebPageProxy::processDidTerminate: (pid 2080), reason 3

I believe this is the result of the OS killing the webview process. It doesn't describe the real issue on why the OS decided to kill the webview process in the first place, but in my experience it's because it's usually because of some long running task that is blocking the webview from being responsive. I don't really have much evidence to back this up however and information regarding the reason code is rather sparse.

breautek avatar May 27 '22 18:05 breautek

I unfortunately have the same issue. Could be memory related (?)

therealPaulPlay avatar Jan 24 '23 15:01 therealPaulPlay

For me it was a problem with the modals (windows) loading in the back. I had to destroy them - not only hide. Hope it helps.

MarcelSchuermann avatar Jan 24 '23 16:01 MarcelSchuermann

Thanks, that’s a helpful insight. However, I unfortunately need to load them in the background.

therealPaulPlay avatar Jan 24 '23 17:01 therealPaulPlay