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

Crash when calling LDClient.start with large startWaitSeconds on Apple Silicon #392

Closed
borodindr opened this issue Jun 6, 2024 · 6 comments

Comments

@borodindr
Copy link

Describe the bug
When calling LDClient.start method with startWaitSeconds greater than 15, app crashes when it is trying to log the message. Happens only when a project running on Apple Silicon Mac with MacOS 14.4 or higher. Please don't be confused with Run Destination, it can be any.

To reproduce
Required equipment:

  • Mac with Apple Silicon (M1, M2 etc)
  • MacOS 14.4 or higher

Call the following anywhere on app launch:

let config = LDConfig(mobileKey: "key", autoEnvAttributes: .disabled)
LDClient.start(config: config, startWaitSeconds: 60)

Expected behavior
Log message is displayed and the app continue to work.

Logs
Screenshot of the crash:
Screenshot 2024-06-05 at 7 21 32 PM

Library version
LaunchDarkly 9.8.0 and 9.8.1.

XCode and Swift version

  • Xcode - reproduced on 15.4 and 15.3
  • Swift - 5.9
  • Run from MacOS 14.4 or higher with Apple Silicon
  • Run destination - MacOS 14.4+ or any iOS

Platform the issue occurs on
All platforms if project ran from Xcode on MacOS 14.4 or higher with Apple Silicon

Additional context
When calling os_log in LDClient.start method (line 792 in LDClient.swift file), the message has 3 parameters: %s, %d and %s or string, decimal and string. But then arguments passed are String, Double and Double. On older MacOS versions, if argument type doesn't match, it will log (null) but starting from MacOS 14.4 on Apple Silicon it produces an exception.

Possible solution could be changing the third argument in the log message from %s to %d like below:

os_log("%s LDClient.start was called with a timeout greater than %d seconds. We recommend a timeout of less than %d seconds.", log: config.logger, type: .debug, self.typeName(and: #function), LDClient.longTimeoutInterval, LDClient.longTimeoutInterval)
@tanderson-ld
Copy link
Contributor

@borodindr , thank you for reporting this and we appreciate the extra info you collected. We will take a look and release a fix when ready.

@tanderson-ld
Copy link
Contributor

@borodindr
Copy link
Author

Great! Thank you for the quick response.

@tanderson-ld
Copy link
Contributor

@borodindr , version 9.8.2 has been released and this issue should be fixed. I wasn't able to reproduce the issue myself since I don't have that specific device. Please let us know whether or not this resolves the issue for you. Thank you.

@borodindr
Copy link
Author

@tanderson-ld version 9.8.2 was validated and the issue is fixed. Thank you!

@tanderson-ld
Copy link
Contributor

@borodindr , thank you for positively confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants