ios-client-sdk icon indicating copy to clipboard operation
ios-client-sdk copied to clipboard

EXC_BAD_ACCESS FlagSynchronizer:63

Open m1entus opened this issue 2 years ago • 5 comments

Describe the bug Crash (synchronization issue)

SDK version 9.1.1

OS/platform iOS

Additional context Zrzut ekranu 2023-10-17 o 10 57 18

Seems this is retain cycle issue:

self.throttler.runThrottled {
      // since going online was throttled, check the last called setOnline value and whether we can go online
      self.go(online: goOnline && self.canGoOnline, reasonOnlineUnavailable: self.reasonOnlineUnavailable(goOnline: goOnline), completion: completion)
}

here you are capturing self inside throttler: LDClient -> throttler -> runQueue -> runThrottled -> self (LDClient)

this method should look like this:

self.throttler.runThrottled { [weak self] in
      guard let self else {
          completion?()
          return
      }
      // since going online was throttled, check the last called setOnline value and whether we can go online
      self.go(online: goOnline && self.canGoOnline, reasonOnlineUnavailable: self.reasonOnlineUnavailable(goOnline: goOnline), completion: completion)
}

m1entus avatar Oct 17 '23 08:10 m1entus

Hi @m1entus , how frequently are you encountering this issue? Also, thank you for digging deeply and providing an option to fix the issue.

tanderson-ld avatar Oct 17 '23 17:10 tanderson-ld

Just got one crash in Sentry analitycs - so preety rare, but maybe this also can caouse because app is entering background and you are dosing some async action, hard to say really.

m1entus avatar Oct 17 '23 17:10 m1entus

@m1entus , could you provide a rough estimate of number of sessions your customer base runs per day? That will help us evaluate the frequency in a relative percentage.

tanderson-ld avatar Oct 24 '23 15:10 tanderson-ld

@tanderson-ld To be honest it appears only once so far

m1entus avatar Oct 25 '23 09:10 m1entus