Backendless Support
 
Answered

Crash on UserService:logout sync method

calling logout on the UserService occasionally crashes the application with the iOS SDK (version 4.0.15).

Relevant part of the crash dump is here:

  1. Crashed: com.apple.main-thread
  2. 0 libobjc.A.dylib 0x185b797f4 objc_object::release() + 16
  3. 1 Call The Staff 0x102fcbd14 -[UserService onLogout:] (UserService.m:573)
  4. 2 Call The Staff 0x102fc9264 -[UserService logout] (UserService.m:203)

Thanks!

Leave a Comment

Comments (8)

photo
1

Hi Joshua,

In the sources I see this line:

  1. [backendless.headers removeObjectForKey:BACKENDLESS_USER_TOKEN];

But I'm not sure how executing it leads to a crash.

Are you able to reproduce it?

photo
1

I've checked and everything works fine.

If you're able to reproduce it, please share it with us (you can send the achieved project to support@backendless.com).

Regards, Olga

photo
1

I forgot the source was available! Good to look at, thanks for the link.

I'll try to put together a minimal reproducer. to send your way. I agree - that line (and the lines right around it) don't seem like they would cause any problems. The release of 'self.currentUser' is the only thing that may be an issue? I don't really see how it could be though unless the reference count is already 0 from somewhere else in the process. The stack trace doesn't really show how that could be though (since the only other place in the Backendless code that is touched, from what I can see, is from the logout method at line 192. Just in case this shed any other light, the full stack is here from a crash I just got to happen this morning:

  1. Crashed: com.apple.main-thread
  2. 0 libobjc.A.dylib 0x1831b97f4 objc_object::release() + 16
  3. 1 Call The Staff 0x1040e1490 -[UserService onLogout:] (UserService.m:573)
  4. 2 Call The Staff 0x1040de9e0 -[UserService logout] (UserService.m:203)
  5. 3 Call The Staff 0x1040aa8e8 BackendlessManager.logout() -> () (BackendlessManager.swift:253)
  6. 4 Call The Staff 0x1040d0eb4 specialized HomeViewController.handleButtonPress(sender : UIButton) -> () (HomeViewController.swift:75)
  7. 5 Call The Staff 0x1040d06b4 @objc HomeViewController.handleButtonPress(sender : UIButton) -> () (HomeViewController.swift)
  8. 6 UIKit 0x18d0cc20c -[UIApplication sendAction:to:from:forEvent:] + 96
  9. 7 UIKit 0x18d0cc18c -[UIControl sendAction:to:forEvent:] + 80
  10. 8 UIKit 0x18d0b6f4c -[UIControl _sendActionsForEvents:withEvent:] + 440
  11. 9 UIKit 0x18d0cba80 -[UIControl touchesEnded:withEvent:] + 576
  12. 10 UIKit 0x18d717ec8 _UIGestureEnvironmentSortAndSendDelayedTouches + 4280
  13. 11 UIKit 0x18d713488 _UIGestureEnvironmentUpdate + 1196
  14. 12 UIKit 0x18d712f88 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 404
  15. 13 UIKit 0x18d7120e4 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 276
  16. 14 UIKit 0x18d0c6a54 -[UIWindow sendEvent:] + 3180
  17. 15 UIKit 0x18d098078 -[UIApplication sendEvent:] + 340
  18. 16 UIKit 0x18d9d7f98 __dispatchPreprocessedEventFromEventQueue + 2364
  19. 17 UIKit 0x18d9da408 __handleEventQueueInternal + 4760
  20. 18 UIKit 0x18d9d3574 __handleHIDEventFetcherDrain + 152
  21. 19 CoreFoundation 0x183c30358 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
  22. 20 CoreFoundation 0x183c302d8 __CFRunLoopDoSource0 + 88
  23. 21 CoreFoundation 0x183c2fb60 __CFRunLoopDoSources0 + 204
  24. 22 CoreFoundation 0x183c2d738 __CFRunLoopRun + 1048
  25. 23 CoreFoundation 0x183b4e2d8 CFRunLoopRunSpecific + 436
  26. 24 GraphicsServices 0x1859dff84 GSEventRunModal + 100
  27. 25 UIKit 0x18d0fb880 UIApplicationMain + 208
  28. 26 Call The Staff 0x10407b6a8 main (AppDelegate.swift:16)
  29. 27 libdyld.dylib 0x18367256c start + 4

and my method that is calling this doesn't do anything with references to the user either:

  1. func logout(){
  2. backendless.userService.logout()
  3. let fbManager: FBSDKLoginManager = FBSDKLoginManager()
  4. fbManager.logOut()
  5. }

I'll see if I can get you a project to try out. Thanks!

photo
1

what is your preferred way for me to send you a zip file and instructions for testing?

photo
1

Joshua,

The best option would be sending the project with instructions to support@backendless.com.

Thanks

photo
1

Also, please minimise your app as possible. The project should be minimal, complete and verifiable - e.g if the app crashes on logout, there shouldn't be any code responsible for the push notifications (it requires your development team and app bundle id). It should be as simple as possible. Thanks.

photo
1

Closed according to the user response in Slack.

> I stripped out more from what I sent yesterday, and the crash has gone away. I’ll go through and see what triggers it when I add more in (pushes, database management, etc). Thanks! I think you can close the issue for now.

photo
1

Hello Joshua,

Did you solve the problem?