Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

ChatClient shutdown() method crash #28

Closed
iTruff opened this issue Dec 13, 2017 · 17 comments
Closed

ChatClient shutdown() method crash #28

iTruff opened this issue Dec 13, 2017 · 17 comments
Labels
disposition:filed-internally This issue has a Twilio-internal tracking ticket disposition:pending-release Fix is implemented and is pending release clearance

Comments

@iTruff
Copy link

iTruff commented Dec 13, 2017

After calling ChatClient.shutdown(); in onDestroy() method of my activity i see this crash in logs:

12-13 16:13:56.414 com.brainagency.clevergig D/MainActivity: onDestroy: 
12-13 16:13:56.414 com.brainagency.clevergig D/TwilioClient: shutdown: 
12-13 16:13:56.414 com.brainagency.clevergig D/TwilioClient: shutdown: Start shutdown...
12-13 16:13:56.432 com.brainagency.clevergig W/TWC: TNRegNotificationCtxSession:       495654655216 | 12/13/16:13:56.432 | WARNING  | 18     | TNRegNotificationCtxSession | Could not operate with notification context in twilsock. Error 9
12-13 16:13:56.434 com.brainagency.clevergig E/TWC: TNWebsocket:       495618815216 | 12/13/16:13:56.434 | CRITICAL | 5      | TNWebsocket | Received error while waiting for message: Net Exception
12-13 16:13:56.436 com.brainagency.clevergig A/libc: invalid pthread_t 0x73650f54f0 passed to libc
12-13 16:13:56.437 com.brainagency.clevergig A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 31626 (evergig - 31625), pid 31540 (gency.clevergig)
 @Override
    protected void onDestroy() {
        Log.d(TAG, "onDestroy: ");
        TwilioClient.getInstance().shutdown();
        Log.d(TAG, "onDestroy: After shutdown");
        super.onDestroy();
    }
 public void shutdown() {
        Log.d(TAG, "shutdown: ");

        if (mChatClient != null) {
            Log.d(TAG, "shutdown: Start shutdown...");
            mChatClient.shutdown();
            mChatClient = null;
            Log.d(TAG, "shutdown: Shutdown finished");
        }
    }
@berkus
Copy link
Contributor

berkus commented Dec 13, 2017

And this is on Andoid 8.0 right?

@iTruff
Copy link
Author

iTruff commented Dec 13, 2017

Google Pixel, Android 8.1.0

@berkus
Copy link
Contributor

berkus commented Dec 13, 2017

Interesting, I wonder why i cannot reproduce this. Could you share the code with me privately for debug purposes?

@iTruff
Copy link
Author

iTruff commented Dec 13, 2017

Sure, how can I do this?

@berkus
Copy link
Contributor

berkus commented Dec 14, 2017

Do you have Telegram? Skype also works. Ping @berkus there.
You could also open a ticket on https://support.twilio.com and attach it there.

@iTruff
Copy link
Author

iTruff commented Dec 14, 2017

@berkus skype - icaesy

@berkus
Copy link
Contributor

berkus commented Dec 14, 2017

Pinged you on skype.

@berkus
Copy link
Contributor

berkus commented Dec 14, 2017

This seems to be a reproducible case for #19 and thanks @iTruff for providing reproduction code, I will close this one - keep an eye on #19 for when actual update goes out.

@kurtacious
Copy link

kurtacious commented Jun 12, 2018

Hi @berkus,

I'm experiencing a crash on ChatClient#shutdown() calls since upgrading the SDK from 2.0.8 to 3.1.0 in our app. From what I've gathered, this only happens on devices with API 26 and above.

More specifically, I've experiences this crash on:

  • Pixel 2XL (emulator), Android 8.0
  • Pixel 2XL (emulator), Android 8.1
  • Pixel XL, Android 9 developer preview 3

The log generated is similar to OP's as well:

06-12 09:11:29.425  5866  5866 F libc    : invalid pthread_t 0x90108970 passed to libc
06-12 09:11:29.425  5866  5866 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 5866 (xxx.xxxxxxxxxxx)

I have gathered a log per your instructions here and will be happy to email them to you.

@berkus
Copy link
Contributor

berkus commented Jun 12, 2018

@kurtacious thanks! Could you please open a zendesk ticket with support.twilio.com and post it's id here?

@berkus berkus reopened this Jun 12, 2018
@kurtacious
Copy link

@berkus I opened a ticket shortly after commenting here, but did not receive a ticket id. Just a confirmation banner saying "Your request was successfully submitted." However, I did hear back from support and they're escalating the issue (to you, I'm guessing 😄).

@berkus
Copy link
Contributor

berkus commented Jun 12, 2018

Thanks, I will ping them tomorrow about it then.

@berkus
Copy link
Contributor

berkus commented Jun 13, 2018

@kurtacious Thanks, I've received the logs. Just to confirm: are you calling shutdown while ChatClient is still receiving some channel messages?

@kurtacious
Copy link

@berkus Can you clarify what you mean by receiving some channel messages? I'm calling shutdown() on the chat client when my Activity is destroyed. At that moment, there are not any outstanding requests to get channel messages (via getLastMessages or getMessagesBefore), but I do still have a listener attached to the channel. Do you mind if I reach out to you on Skype?

@berkus
Copy link
Contributor

berkus commented Jun 14, 2018

What i'm seeing in the logs is that chatclient just started booting up and it's immediately shut down - this causes some outstanding requests to fire into the void, causing a crash.

This is something that we do not plan to fix in the current iteration of SDKs, there's an update pending merge that should make things better as it uses a different async architecture internally. This means, we'd need to find a way to work around the issue on your side, for example by delaying chatclient shutdown until it is fully synced. To make sure this is doable we'd need to figure out use case for this instance.

Lets skype about it, add skype:berkus.

@berkus
Copy link
Contributor

berkus commented Jun 19, 2018

With @kurtacious 's help I've reproduced one of the crashes.

@berkus berkus added disposition:filed-internally This issue has a Twilio-internal tracking ticket disposition:pending-release Fix is implemented and is pending release clearance labels Jun 19, 2018
@berkus
Copy link
Contributor

berkus commented Jun 19, 2018

Release 3.1.1 should fix the related crashes (and some more).

Thank you all!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
disposition:filed-internally This issue has a Twilio-internal tracking ticket disposition:pending-release Fix is implemented and is pending release clearance
Projects
None yet
Development

No branches or pull requests

3 participants