EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) when a user leave the sessions

Description

When other joined user leaves the session, app gets crashed with EXC_BAD_ACCESS. after enabling the zombies from the project build scheme I got the same result with following descriptive error

2021-01-15 14:14:42.163521+0530 ZoomOneToOneExample[4503:170158] *** -[ZoomInstantSDKUserImpl release]: message sent to deallocated instance 0x606000203000

Which version?
Latest

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Integrate Instant SDKs
  2. Successful initialize the app
  3. Create and join a session
  4. Join same session from sample app
  5. Leave session from sample app

Screenshots
Screen Shot 2021-01-15 at 5.21.58 PM|690x431 problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone 8]
  • OS: [e.g. iOS 13.3]
  • Xcode Version : 13.3.1

i am facing the issues in every call back. even when user send the chat message. please help me as soon as possible. let me know if you need anymore details.

Thank You. hoping to hear from the team soon.

Update:

i have been doing things and it turns out that if I use the same app on a different device if I leave a session from one device the other one is getting crashed.

language I am using is Swift.

Please help as soon as possible.

Hey @dhruv.vhits,

Thanks for using the dev forum!

That is very strange, I am sorry that is happening. Can you answer the following so that we can troubleshoot:

What version of the SDK are you using?
Are both users using the same credentials?
Does this happen if both users are using the sample application?
Is the delegate nil before the app crashes?

Thanks!
Michael

Hey @Michael_Condon ,

Thanks for your reply!

i am using 1.0.1 SDK.

Yes Both Users are using the same credentials.

No, and if I use the CanvasViewController of the Sample app in my app, the issue is not occurring. but if I use my own controller it happens.

i have even tried Obj-C

here is the code if you might help,

 #import "FirstViewController.h"
#import "ZoomInstantSample-Prefix.pch"
#import "CanvasViewController.h"


@interface FirstViewController ()  <ZoomInstantSDKDelegate>
@property (nonatomic, strong) ZoomView  *fullScreenCanvas;

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.redColor;
    NSLog(@"i am loaded");
    [ZoomInstantSDK shareInstance].delegate = self;
    [UIApplication sharedApplication].idleTimerDisabled = YES;
    // Do any additional setup after loading the view.
}

- (void)onSessionJoin{
    NSLog(@"Joined");
}

- (void)onSessionLeave{
    NSLog(@"Left");
}

- (void)onUserJoin:(ZoomInstantSDKUserHelper *)helper users:(NSArray<ZoomInstantSDKUser *> *)userArray{
    NSLog(@"%@", userArray);
}

- (void)onUserLeave:(ZoomInstantSDKUserHelper *)helper users:(NSArray<ZoomInstantSDKUser *> *)userArray {
    
    NSLog(@"User left");
}

- (void)dealloc {
    [UIApplication sharedApplication].idleTimerDisabled = NO;
    [ZoomInstantSDK shareInstance].delegate = nil;
}

No, I get the Call back of onUserLeave and then the app gets crashed.

Thanks and Regards. Hope to hear from you soon.

Hey @dhruv.vhits,

That is very interesting, I am having trouble reproducing the same issue.
Does this also crash if you remove your delegate code? As in comment out all of the code that is within the body of the delegate implementations.

Thanks!
Michael

Hey @Michael_Condon Thanks for replying,

I have tried removing my all delegate code and it’s still crashing.

I have actually found something more about the problem. the memory address which is causing the crash is actually being allocated to the user when it joins the session and the same address is being accessed after the user object is deallocated. I hope this one helps more to find the issue.

it’s a lot to ask but if possible can you please try to reproduce it by creating a new project?

Thanks and regards! have a happy week ahead.

Hey @dhruv.vhits,

Yes, I will try to reproduce this in a new application. If I cannot reproduce I will share my code here for you to compare to.

Update: While creating this new application, I have experienced the same crash! I will work to find a workaround for you, and will inform the team of this. Thank you for bringing this to our attention.

Thanks!
Michael

Hey @dhruv.vhits,

Would you like Swift or Objective-C for code samples?

Thanks!
Michael

Hey @Michael_Condon,

You’re welcome, I am glad that I was helpful.

Thanks for your reply and efforts. Swift code samples would be great.

Thanks and regards.

Hey @dhruv.vhits,

Sounds good. I will provide swift examples if we find a workaround or the root cause.

Thanks!
Michael

1 Like

Hey @Michael_Condon ,

Thank you for your efforts. Hope to hear from you soon.

Regards!

You are welcome! I am sorry this is happening, crashes are unacceptable.

Thanks!
Michael

FYI I’ve seen the exact same behavior but found a workaround.

It seems like you need to hold a reference to the user that comes in in the onUserJoin() callback. I basically add them to an array and then when onUserLeave is called you need to find the same user and delete it.

1 Like

Hey @brians,

Thank you for providing this workaround, I will update the team. The are still investigating the root cause of the issue.

Thanks!
Michael

Did you find root cause of the issue? I was getting exact same error, and I just found out the root cause, but I am using core data and issue was when I was accessing object of type NSManagedObject from a different thread than the one it was created on. I’m not sure if you are using core data, but just trying to help. (ios - Core Data objects become null - Stack Overflow)

Hey @meharoof,

Thank you for providing this!

Michael

1 Like