Bug 220409

Summary: Image/video/audio file is not uploading in the web page.
Product: WebKit Reporter: Vivek <vivekmradadiya>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: aestes, cdumez, sean.batson, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description Vivek 2021-01-07 05:35:05 PST
I have implemented a WKWebView in my app and some web pages contains functionalities of uploading image/video/audio files from an application to the web page.
On tapping on the file picker tag in the web page, the app opens the OS file picker view, and it allows the user to pick an image/video/audio file. But the file is not uploading into the web page.

Showing some warnings in the console of XCode:

[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}>

[ProcessSuspension] 0x7fc6c2404240 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 3338, 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}

[ProcessSuspension] 0x7fc6c1e04fd0 - ProcessAssertion: Failed to acquire RBS UnboundedNetworking assertion 'WebKit uploads' for process with PID 3357, error: Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"UnboundedNetworking" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}
Comment 1 Radar WebKit Bug Importer 2021-01-14 05:36:13 PST
<rdar://problem/73194613>
Comment 2 Sean Batson 2021-09-22 06:57:47 PDT
Hi,
Do we have an ETA on this issue and is there an entitlements file that can be manually created for a release to store iOS app?

Sean.
Comment 3 Chris Dumez 2021-09-22 07:12:17 PDT
(In reply to Vivek from comment #0)
> I have implemented a WKWebView in my app and some web pages contains
> functionalities of uploading image/video/audio files from an application to
> the web page.
> On tapping on the file picker tag in the web page, the app opens the OS file
> picker view, and it allows the user to pick an image/video/audio file. But
> the file is not uploading into the web page.
> 
> Showing some warnings in the console of XCode:
> 
> [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}>
> 
> [ProcessSuspension] 0x7fc6c2404240 - ProcessAssertion: Failed to acquire RBS
> Background assertion 'WebProcess Background Assertion' for process with PID
> 3338, 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}
> 
> [ProcessSuspension] 0x7fc6c1e04fd0 - ProcessAssertion: Failed to acquire RBS
> UnboundedNetworking assertion 'WebKit uploads' for process with PID 3357,
> error: Error Domain=RBSAssertionErrorDomain Code=3 "Required client
> entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute|
> domain:"com.apple.webkit" name:"UnboundedNetworking"
> sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client
> entitlement is missing}

These "errors" you are showing are expected in WKWebView apps other than Safari. They are very likely not related to your problem.
Comment 4 Sean Batson 2021-09-22 07:19:35 PDT
Hi Chris,

The problems are related as described by the reporter above. As a developer, we don't have an option of providing the needed entitlements on a shippable iOS app.
Comment 5 Sean Batson 2021-09-22 07:22:00 PDT
Uploads to the server are missing when this happens.
Comment 6 Chris Dumez 2021-09-22 07:24:25 PDT
(In reply to Sean Batson from comment #5)
> Uploads to the server are missing when this happens.

You don't need an entitlement to do uploads, unless the app is in the background. Apps, in general, are not allowed to run in the background for extended periods of time.

If the app is foreground, then no entitlement / RBS assertion is needed and this logging is just noise.
Comment 7 Sean Batson 2021-09-22 07:27:22 PDT
The application is in the foreground when this happens.
Comment 8 Sean Batson 2021-09-22 07:28:57 PDT
Enev though this is just noise in the foreground when this warning surfaces, we do not have a record of the uploaded file server-side.
Comment 9 Chris Dumez 2021-09-22 07:31:00 PDT
(In reply to Sean Batson from comment #7)
> The application is in the foreground when this happens.

Then as I said, the errors being logged are unrelated. RBS assertions are used to prevent a process from getting suspended when the app is in the background.

I don't have enough information to debug this but the fact that WebKit even tried to take a UnboundedNetworking RBS assertion indicates that we detected a network upload. So this seems to indicate that the WebKit network process is actually doing a network upload. The fact that the RBS assertion could not be taken wouldn't abort the upload.
Comment 10 Chris Dumez 2021-09-22 07:48:34 PDT
Could you take a sysdiagnose right after reproducing the issue and send that to me? Hopefully I can spot something from the logs even though I cannot reproduce myself.
Comment 11 Alexey Proskuryakov 2022-10-02 16:05:58 PDT
Closing, as this is not actionable without a response.