Skip to content

[Bug]: Crash due to WKWebView deallocation from a background thread #83

@nalexn

Description

@nalexn

Are you seeing the problem on Android or iOS?

iOS

Contact Details

Describe the bug

Crash

Site Key

No response

Select the method used to integrate with reCAPTCHA Mobile.

SPM (iOS)

SDK Version

18.4.0

To Reproduce

We don't know the exact steps that lead to a crash.

Expected behavior

The SDK should not crash the host app.

Development IDE

Xcode 15.2

To Reproduce

It happened on a variety of phone models and OS versions, there is no pattern.

Relevant log output

The crash report refers to obfuscated class and method names, specifically `mAyzaYEh` class and `mAyzaYEh.szjxzvtp(withvwqnhbxp:withTimeout:completionHandler:)` method.

How do we know it's Recaptcha's class? We looked it up in Obj-C runtime, `mAyzaYEh` is defined in RecaptchaEnterprise framework.

A portion of the crash report with the essential info:

NSInternalInconsistencyException: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.

0  CoreFoundation +0xec698         ___exceptionPreprocess
1  libobjc.A.dylib +0x2bc7c        _objc_exception_throw
2  CoreAutoLayout +0x56c4          __AssertAutoLayoutOnAllowedThreadsOnly
3  CoreAutoLayout +0xa4e0          -[NSISEngine withBehaviors:performModifications:]
4  UIKitCore +0x10dd8              -[UIView _postMovedFromSuperview:]
5  UIKitCore +0x7f6f0              ___UIViewWasRemovedFromSuperview
6  UIKitCore +0x7ee6c              -[UIView(Hierarchy) removeFromSuperview]
7  WebKit +0x47bbd4                -[WKWebView(WKViewInternalIOS) removeFromSuperview]
8  PCoreServices +0x919abc         @objc mAyzaYEh.__deallocating_deinit
9  PCoreServices +0x91437c         type metadata accessor for NSKeyedUnarchiver
10 libswiftCore.dylib +0x3a6910    __swift_release_dealloc
11 libswiftCore.dylib +0x3a7fac    bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int)
12 PCoreServices +0x9133ac         partial apply for implicit closure #2 in implicit closure #1 in mAyzaYEh.szjxzvtp(withvwqnhbxp:withTimeout:completionHandler:)
13 libswiftCore.dylib +0x3a6910    __swift_release_dealloc


### Relevant log output

_No response_

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions