Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MallocStackLogging breaks Segment when fetching user agent #353

Closed
lhunath opened this issue Jun 26, 2024 · 1 comment
Closed

MallocStackLogging breaks Segment when fetching user agent #353

lhunath opened this issue Jun 26, 2024 · 1 comment
Assignees
Labels

Comments

@lhunath
Copy link

lhunath commented Jun 26, 2024

Describe the bug
When MallocStackLogging is enabled in an app's scheme, Segment breaks on

Self.asyncUserAgent = WKWebView().value(forKey: "userAgent") as? String

with main (1): EXC_BREAKPOINT (code=1, subcode=0x1ab7b7a18)

To Reproduce
Steps to reproduce the behavior:

  1. In your application scheme, enable MallocStackLogging
  2. Initialize and start up segment on launch
  3. See error

Expected behavior
no crash during start-up

Screenshots
image
image

Platform (please complete the following information):

  • Library Version in use: 1.5.11
  • Platform being tested: iOS
  • Integrations in use: Firebase

Additional context
Maybe related: #229
Backtrace:

(lldb) bt
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1ab7b7a18)
    frame #0: 0x00000001ab7b7a18 libsystem_malloc.dylib`xzm_malloc_zone_free_slow.cold.1 + 28
    frame #1: 0x00000001ab7b19cc libsystem_malloc.dylib`xzm_malloc_zone_free_slow + 520
    frame #2: 0x00000001b2c5f4bc JavaScriptCore`pas_try_deallocate_slow_no_cache + 428
    frame #3: 0x00000001b1780fac JavaScriptCore`WTF::String::String(__CFString const*) + 620
    frame #4: 0x00000001b09176b4 WebKit`WebKit::isFullWebBrowserOrRunningTest() + 28
    frame #5: 0x00000001b0917530 WebKit`WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration(WebKit::IsPersistent, WebKit::WebsiteDataStoreConfiguration::ShouldInitializePaths) + 136
    frame #6: 0x00000001b07e7e44 WebKit`WebKit::WebsiteDataStore::defaultDataStore() + 164
    frame #7: 0x00000001b07e7d48 WebKit`+[WKWebsiteDataStore defaultDataStore] + 28
    frame #8: 0x00000001b07e7cf4 WebKit`-[WKWebViewConfiguration websiteDataStore] + 40
    frame #9: 0x00000001b07e507c WebKit`-[WKWebView _initializeWithConfiguration:] + 92
    frame #10: 0x00000001b0886224 WebKit`-[WKWebView initWithFrame:configuration:] + 72
    frame #11: 0x00000001b0d98030 WebKit`-[WKWebView initWithFrame:] + 88
    frame #12: 0x000000010722116c InstrumentationDefault`specialized closure #1 in iOSVendorSystem.userAgent.getter [inlined] @nonobjc __C.WKWebView.init() -> __C.WKWebView at <compiler-generated>:0 [opt]
    frame #13: 0x0000000107221160 InstrumentationDefault`specialized closure #1 in iOSVendorSystem.userAgent.getter [inlined] __C.WKWebView.__allocating_init() -> __C.WKWebView at <compiler-generated>:0 [opt]
  * frame #14: 0x0000000107221154 InstrumentationDefault`specialized closure #1 in iOSVendorSystem.userAgent.getter at AppleUtils.swift:84:39 [opt]
    frame #15: 0x000000010725f90c InstrumentationDefault`thunk for @escaping @callee_guaranteed () -> () at <compiler-generated>:0 [opt]
    frame #16: 0x00000001070f0b98 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #17: 0x00000001070f27bc libdispatch.dylib`_dispatch_client_callout + 20
    frame #18: 0x0000000107102d58 libdispatch.dylib`_dispatch_main_queue_drain + 1084
    frame #19: 0x000000010710290c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #20: 0x000000019b5cb710 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #21: 0x000000019b5c8914 CoreFoundation`__CFRunLoopRun + 1996
    frame #22: 0x000000019b5c7cd8 CoreFoundation`CFRunLoopRunSpecific + 608
    frame #23: 0x00000001e04781a8 GraphicsServices`GSEventRunModal + 164
    frame #24: 0x000000019dc0090c UIKitCore`-[UIApplication _run] + 888
    frame #25: 0x000000019dcb49d0 UIKitCore`UIApplicationMain + 340
    frame #26: 0x000000019f7b8148 SwiftUI`___lldb_unnamed_symbol74307 + 168
    frame #27: 0x000000019f764714 SwiftUI`___lldb_unnamed_symbol71237 + 152
    frame #28: 0x000000019f7704d0 SwiftUI`___lldb_unnamed_symbol71675 + 132
    frame #29: 0x0000000104e2def4 Hubstaff`main [inlined] static Hubstaff.HubstaffApp.$main() -> () at HubstaffApp.swift:0 [opt]
    frame #30: 0x0000000104e2dec0 Hubstaff`main at HubstaffApp.swift:0 [opt]
    frame #31: 0x00000001bec79e4c dyld`start + 2240
@bsneed
Copy link
Contributor

bsneed commented Jun 26, 2024

Thanks @lhunath! This change here would fix that:

#341

We've got some other stuff in progress, once it lands it'll all get released.

@bsneed bsneed closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants