Bug 271664 - [iOS 17.4] Local WebKit builds don't use locally-built app extensions, lldb cannot attach
Summary: [iOS 17.4] Local WebKit builds don't use locally-built app extensions, lldb c...
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Process Model (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 272442 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-25 10:57 PDT by Ali Juma
Modified: 2024-05-10 09:47 PDT (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Juma 2024-03-25 10:57:05 PDT
When building WebKit for the iOS simulator after 276550@main (so that USE_EXTENSIONKIT is true), local builds try to use app extensions from the simulator runtime rather than their locally-built counterparts.

For example, rather than using WebKitBuild/Debug-iphonesimulator/WebContentExtension.appex, local builds instead try to use /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/ExtensionKit/Extensions/WebContentExtension.appex

In practice this means that local builds are very broken, since they are combining locally-built WebKit.framework with pre-built app extensions, resulting in mismatching IPC messages.

Is there some additional configuration needed to get ExtensionKit builds working with the public SDK?
Comment 1 Per Arne Vollan 2024-03-26 09:08:54 PDT
(In reply to Ali Juma from comment #0)
> When building WebKit for the iOS simulator after 276550@main (so that
> USE_EXTENSIONKIT is true), local builds try to use app extensions from the
> simulator runtime rather than their locally-built counterparts.
> 
> For example, rather than using
> WebKitBuild/Debug-iphonesimulator/WebContentExtension.appex, local builds
> instead try to use
> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/
> CoreSimulator/Profiles/Runtimes/iOS
> 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/ExtensionKit/
> Extensions/WebContentExtension.appex
> 
> In practice this means that local builds are very broken, since they are
> combining locally-built WebKit.framework with pre-built app extensions,
> resulting in mismatching IPC messages.
> 
> Is there some additional configuration needed to get ExtensionKit builds
> working with the public SDK?

Thanks for reporting this issue!

The extension executables themselves are very small executables that just calls into the WebKit framework. What specific issues are you seeing? Since the IPC code is contained in the WebKit framework, I would not immediately expect there to be mismatches with regards to IPC messaging.
Comment 2 Ali Juma 2024-03-26 12:24:44 PDT
(In reply to Per Arne Vollan from comment #1)
> Thanks for reporting this issue!
> 
> The extension executables themselves are very small executables that just
> calls into the WebKit framework. What specific issues are you seeing?

The main issue is that since these executables are part of the system, SIP prevents attaching a debugger to them, even if they are ultimately calling into the WebKit framework.

> Since
> the IPC code is contained in the WebKit framework, I would not immediately
> expect there to be mismatches with regards to IPC messaging.

Sometimes on launch, NetworkProcessProxy::didReceiveNetworkProcessProxyMessage
receives a WebSWServerConnection_WhenServiceWorkerIsTerminatedForTesting message which it should never receive outside of tests, so fails an assertion for this unhandled message. That made me think that the sender and receiver were using different versions of the MessageName enum, but since this is not consistent it's probably unrelated.
Comment 3 Per Arne Vollan 2024-03-27 08:29:05 PDT
(In reply to Ali Juma from comment #2)
> (In reply to Per Arne Vollan from comment #1)
> > Thanks for reporting this issue!
> > 
> > The extension executables themselves are very small executables that just
> > calls into the WebKit framework. What specific issues are you seeing?
> 
> The main issue is that since these executables are part of the system, SIP
> prevents attaching a debugger to them, even if they are ultimately calling
> into the WebKit framework.
> 

That is a good point! I will look into ways of resolving this.

> > Since
> > the IPC code is contained in the WebKit framework, I would not immediately
> > expect there to be mismatches with regards to IPC messaging.
> 
> Sometimes on launch,
> NetworkProcessProxy::didReceiveNetworkProcessProxyMessage
> receives a WebSWServerConnection_WhenServiceWorkerIsTerminatedForTesting
> message which it should never receive outside of tests, so fails an
> assertion for this unhandled message. That made me think that the sender and
> receiver were using different versions of the MessageName enum, but since
> this is not consistent it's probably unrelated.
Comment 4 Radar WebKit Bug Importer 2024-04-01 10:58:15 PDT
<rdar://problem/125726458>
Comment 5 Per Arne Vollan 2024-04-09 21:48:41 PDT

*** This bug has been marked as a duplicate of bug 272401 ***
Comment 6 Per Arne Vollan 2024-04-10 11:22:24 PDT
This is still an issue, but the crash you are seeing should be resolved by  https://commits.webkit.org/277304@main.
Comment 7 Ryosuke Niwa 2024-04-10 17:53:31 PDT
*** Bug 272442 has been marked as a duplicate of this bug. ***
Comment 8 Per Arne Vollan 2024-05-10 09:47:48 PDT
*** Bug 273550 has been marked as a duplicate of this bug. ***