prebid / prebid-mobile-ios

Prebid Mobile SDK for iOS applications
Apache License 2.0
46 stars 86 forks source link

Crashes off the main thread in line 25 in UserAgentService #988

Closed jsligh closed 1 month ago

jsligh commented 1 month ago

From #976

There's something off with this. We're seeing a lot of crashes off the main thread in line 25 in UserAgentService private let webView = WKWebView(). WKWebView is supposed to run its init on main

      Crashed: PBMAdLoadFlowController_F13FBE0A-D142-4A42-949C-6D66A5725EC8
0  WebKit                         0x4fd8 <redacted> + 20
1  WebKit                         0x3139c8 <redacted> + 94
2  libc++.1.dylib                 0x13864 std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*)) + 180
3  WebKit                         0x3119e4 <redacted> + 84
4  WebKit                         0x41e6d4 <redacted> + 64
5  WebKit                         0x3df658 <redacted> + 56
6  PrebidMobile                   0xe46c8 @objc UserAgentService.init() + 25 (UserAgentService.swift:25)
7  PrebidMobile                   0xe43f4 one-time initialization function for shared + 21 (UserAgentService.swift:21)
8  libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
9  libdispatch.dylib              0x5654 _dispatch_once_callout + 32
10 PrebidMobile                   0xcf64c @objc PrebidServerConnection.init() + 21 (UserAgentService.swift:21)
11 PrebidMobile                   0xcd348 one-time initialization function for shared + 31 (PrebidServerConnection.swift:31)
12 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
13 libdispatch.dylib              0x5654 _dispatch_once_callout + 32
14 PrebidMobile                   0x74c5c closure #1 in BannerView.init(frame:configID:adSize:eventHandler:) + 31 (PrebidServerConnection.swift:31)
15 PrebidMobile                   0x78210 thunk for @escaping @callee_guaranteed (@guaranteed AdUnitConfig) -> (@owned PBMBidRequesterProtocol) + 48 (<compiler-generated>:48)
16 PrebidMobile                   0xbca4 -[PBMAdLoadFlowController sendBidRequest] + 214 (PBMAdLoadFlowController.m:214)
17 PrebidMobile                   0xbc00 -[PBMAdLoadFlowController tryLaunchingAdRequestFlow] + 208 (PBMAdLoadFlowController.m:208)
18 PrebidMobile                   0xb9b0 __34-[PBMAdLoadFlowController refresh]_block_invoke + 155 (PBMAdLoadFlowController.m:155)
19 PrebidMobile                   0xb890 __45-[PBMAdLoadFlowController enqueueGatedBlock:]_block_invoke + 144 (PBMAdLoadFlowController.m:144)
20 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
21 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
22 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
23 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
24 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
25 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
26 libsystem_pthread.dylib        0x1f20 _pthread_wqthread + 288
27 libsystem_pthread.dylib        0x1fc0 start_wqthread + 8

Originally posted by @weibel in https://github.com/prebid/prebid-mobile-ios/issues/976#issuecomment-2137490697

YuriyVelichkoPI commented 1 month ago

Hi, @weibel!

While @jsligh and @OlenaPostindustria are working on the fix can you share where you initialize the SDK? In application:didFinishLaunchingWithOptions ?

weibel commented 1 month ago

@YuriyVelichkoPI Yes we call Prebid.initializeSDK in application:didFinishLaunchingWithOptions

chwo commented 1 month ago

Hi @jsligh Can you please publish this fix ASAP as a new sdk release. What is you timeline for this release?

Because at the moment the sdk version 2.2.0 does not work as expected (missing UA parameter) but we cannot update to the sdk version 2.2.2 where the UA parameter is fixed because of this crash.

jsligh commented 1 month ago

@chwo we plan on releasing a patch version by end of day tomorrow.

jsligh commented 1 month ago

@chwo @weibel https://github.com/prebid/prebid-mobile-ios/releases/tag/2.2.3

chwo commented 3 weeks ago

@jsligh Thank you for quickly providing the new release.