# EXC\_BAD\_INSTRUCTION (code=EXC\_I386\_INVOP, subcode=0x0) when a user leave the sessions

**URL:** <https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675>\
**Category:** iOS\
**Created:** [January 15, 2021, 11:54am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675 "2021-01-15T11:54:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhruv.vhits](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dhruv.vhits/32/18588_2.png) [@dhruv.vhits](https://devforum.zoom.us/u/dhruv.vhits)\
**Post date:** [January 15, 2021, 11:54am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/1 "2021-01-15T11:54:52Z")

</div>

**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](https://devforum.zoom.us/uploads/short-url/yQ60WouYW5UTfgNtSaDynm3spVB.jpeg) 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.

---

<div class="post-metadata">

**Author:** ![dhruv.vhits](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dhruv.vhits/32/18588_2.png) [@dhruv.vhits](https://devforum.zoom.us/u/dhruv.vhits)\
**Post date:** [January 19, 2021, 10:43am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/2 "2021-01-19T10:43:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 19, 2021, 10:56pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/3 "2021-01-19T22:56:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dhruv.vhits](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dhruv.vhits/32/18588_2.png) [@dhruv.vhits](https://devforum.zoom.us/u/dhruv.vhits)\
**Post date:** [January 20, 2021, 11:09am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/4 "2021-01-20T11:09:50Z")

</div>

Hey @Michael_Condon ,

Thanks for your reply!

> [@Michael\_Condon](#):
>
> What version of the SDK are you using?

i am using 1.0.1 SDK.

> [@Michael\_Condon](#):
>
> Are both users using the same credentials?

Yes Both Users are using the same credentials.

> [@Michael\_Condon](#):
>
> Does this happen if both users are using the sample application?

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;
}

```

> [@Michael\_Condon](#):
>
> Is the delegate nil before the app crashes?

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

Thanks and Regards. Hope to hear from you soon.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 21, 2021, 3:00am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/5 "2021-01-21T03:00:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dhruv.vhits](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dhruv.vhits/32/18588_2.png) [@dhruv.vhits](https://devforum.zoom.us/u/dhruv.vhits)\
**Post date:** [January 25, 2021, 5:30am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/6 "2021-01-25T05:30:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 25, 2021, 7:44pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/7 "2021-01-25T19:44:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 25, 2021, 9:56pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/8 "2021-01-25T21:56:47Z")

</div>

Hey @dhruv.vhits,

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

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![dhruv.vhits](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dhruv.vhits/32/18588_2.png) [@dhruv.vhits](https://devforum.zoom.us/u/dhruv.vhits)\
**Post date:** [January 26, 2021, 3:27pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/9 "2021-01-26T15:27:19Z")

</div>

Hey @Michael_Condon,

> [@Michael\_Condon](#):
>
> Thank you for bringing this to our attention.

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

> [@Michael\_Condon](#):
>
> Would you like Swift or Objective-C for code samples?

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

Thanks and regards.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 26, 2021, 7:13pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/10 "2021-01-26T19:13:37Z")

</div>

Hey @dhruv.vhits,

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

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![dhruv.vhits](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dhruv.vhits/32/18588_2.png) [@dhruv.vhits](https://devforum.zoom.us/u/dhruv.vhits)\
**Post date:** [January 27, 2021, 4:55am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/11 "2021-01-27T04:55:47Z")

</div>

Hey @Michael_Condon ,

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

Regards!

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 27, 2021, 5:37pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/12 "2021-01-27T17:37:35Z")

</div>

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

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![brians](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@brians](https://devforum.zoom.us/u/brians)\
**Post date:** [February 12, 2021, 9:22am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/13 "2021-02-12T09:22:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [February 12, 2021, 10:01pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/14 "2021-02-12T22:01:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![meharoof](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@meharoof](https://devforum.zoom.us/u/meharoof)\
**Post date:** [April 28, 2021, 7:25am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/15 "2021-04-28T07:25:31Z")

</div>

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](https://stackoverflow.com/questions/23357195/core-data-objects-become-null))

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [April 28, 2021, 6:20pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/16 "2021-04-28T18:20:42Z")

</div>

Hey @meharoof,

Thank you for providing this!

Michael

---

<div class="post-metadata">

**Author:** ![hisham](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hisham/32/28620_2.png) [@hisham](https://devforum.zoom.us/u/hisham)\
**Post date:** [June 25, 2021, 2:34am UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/17 "2021-06-25T02:34:53Z")

</div>

Hello,  
Is there’s any update about that issue, I’m facing the same issue and found that  
after enabled the zombie objects from edit scheme

**-[ZoomVideoSDKUserImpl retain]: message sent to deallocated instance**

Hope that issue resolved

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [June 25, 2021, 6:35pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/18 "2021-06-25T18:35:40Z")

</div>

Hi @hisham, thanks for using our SDK.

No updates yet on our end. We will be sure to let you know once we have additional information.

Thanks!

---

<div class="post-metadata">

**Author:** ![hisham](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hisham/32/28620_2.png) [@hisham](https://devforum.zoom.us/u/hisham)\
**Post date:** [June 25, 2021, 7:00pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/19 "2021-06-25T19:00:21Z")

</div>

is there’s any workaround like make the session end using API from the backend or something like that, we can’t release because that issue

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [June 25, 2021, 10:47pm UTC](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675/20 "2021-06-25T22:47:32Z")

</div>

Hi @hisham,

Sorry, but I am not aware of any workarounds right now. I will follow up with the team and see if we can get any additional information.

Thanks!

[Next page](https://devforum.zoom.us/t/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-when-a-user-leave-the-sessions/40675.md?page=2)
