Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash in native library: unpublishVideoTrack #447

Closed
palicka opened this issue Oct 18, 2019 · 10 comments
Closed

App crash in native library: unpublishVideoTrack #447

palicka opened this issue Oct 18, 2019 · 10 comments
Assignees
Labels

Comments

@palicka
Copy link

palicka commented Oct 18, 2019

stack trace:

2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXS6ESI4:user/release-keys'
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: Revision: '9'
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: ABI: 'arm'
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: pid: 15124, tid: 15124, name: *** >>> <<<
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: Cause: null pointer dereference
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: r0 db2bdb74 r1 00000001 r2 00000001 r3 00000000
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: r4 db2bdb78 r5 00000001 r6 db2bdb74 r7 db2bdb78
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: r8 00000000 r9 dd888000 sl fff1b520 fp fff1b4ac
2019-10-18 15:34:45.947 16686-16686/? A/DEBUG: ip 00000035 sp fff1b3b0 lr c14d1333 pc c14d1b28 cpsr 200e0030
2019-10-18 15:34:45.949 16686-16686/? A/DEBUG: backtrace:
2019-10-18 15:34:45.949 16686-16686/? A/DEBUG: #00 pc 0014eb28 /lib/arm/libjingle_peerconnection_so.so
2019-10-18 15:34:45.949 16686-16686/? A/DEBUG: #1 pc 0014e32f /
/lib/arm/libjingle_peerconnection_so.so (Java_com_twilio_video_LocalParticipant_nativeUnpublishVideoTrack+230)
2019-10-18 15:34:45.949 16686-16686/? A/DEBUG: #2 pc 00051e45 /
/oat/arm/base.odex (offset 0x45000)

tested on samsung/xiaomi - same result

it happens when localParticipant.unpublishTrack(localVideoTrack) is called in onPause(), and screen capture is active.. when screen capture is not active, it works fine...

@aaalaniz aaalaniz added the bug label Oct 21, 2019
@aaalaniz
Copy link
Contributor

Hey @palicka

Are you able to reproduce this crash in any of the quickstart modules?

@ahmetkocu
Copy link

ahmetkocu commented Oct 30, 2019

I can reproduce this crash.

When I open the app from notification, app crashes onPasue method.

2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: backtrace:
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #00 pc 0000000000207434 /data/app/com.sugg.app-LhHaeEAlvVPaaGdbq01SVg==/lib/arm64/libjingle_peerconnection_so.so (Java_com_twilio_video_LocalParticipant_nativeUnpublishVideoTrack+360)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #1 pc 0000000000577fe0 /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #2 pc 000000000056ef88 /system/lib64/libart.so (art_quick_invoke_stub+584)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #3 pc 00000000000d4204 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #4 pc 0000000000283fa8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #5 pc 000000000027dfb0 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #6 pc 000000000053fdd8 /system/lib64/libart.so (MterpInvokeDirect+296)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #7 pc 0000000000561714 /system/lib64/libart.so (ExecuteMterpImpl+14484)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #8 pc 00000000001a27de /dev/ashmem/dalvik-classes3.dex extracted in memory from /data/app/com.sugg.app-LhHaeEAlvVPaaGdbq01SVg==/base.apk!classes3.dex (deleted) (com.twilio.video.LocalParticipant.unpublishTrack+78)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #9 pc 0000000000257cb4 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4019025862+488)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #10 pc 000000000025d7a8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #11 pc 000000000027df94 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #12 pc 000000000053ea98 /system/lib64/libart.so (MterpInvokeVirtual+588)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #13 pc 0000000000561614 /system/lib64/libart.so (ExecuteMterpImpl+14228)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #14 pc 00000000000942aa /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.sugg.app-LhHaeEAlvVPaaGdbq01SVg==/base.apk!classes2.dex (deleted) (com.sugg.app.modules.calls.VideoCallActivity.onPause+22)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #15 pc 0000000000257cb4 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4019025862+488)
2019-10-30 19:20:03.259 7039-7039/? A/DEBUG: #16 pc 000000000025d7a8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)

@DmytroBatyuk
Copy link

DmytroBatyuk commented Mar 2, 2020

I'm also able reproduce that crash, is there any way how to eliminate that (Pixel 3, Android 10)

@DmytroBatyuk
Copy link

I have found workaround for now.
I'm initializing video and audio tracks in onCreate method. Unpublish and release tracks in onDestory after room has been disconnected.
@ahmetkocu hope it helps you also

@tuckercr
Copy link

tuckercr commented Mar 3, 2020

I too fixed this by being really careful about how I publish, unpublish and release tracks. What really helped was to migrate all my Twilio Room code from inside my Fragment over to a ViewModel. This made it a lot easier to manage because the ViewModel isn't affected by fragment lifecycle changes caused by rotation, task switching, etc.

Another thing that helped was to increase the Twilio log levels. The log statement immediately before the crash (sorry I forget what it was) was very useful in finding the bug in my code:

Video.setLogLevel(LogLevel.ALL);
Video.setModuleLogLevel(LogModule.WEBRTC, LogLevel.ALL);

@DmytroBatyuk
Copy link

@aaalaniz this issue happens when localVideoTrack hasn't been added to localParticipant. I suppose when unsubscribeTrack is called it doesn't check if track already exists in added list and throw null pointer exception.

How to fix

  1. When create room instance DON'T pass videoTrack to the builder
  2. Publish track into local participant when Room.Lieneter::onConnected
  3. Unbublish track in onPause if localParticipant is initialized, release track
  4. create new track, add it to localParticipant if it's initialized in onResume

@aaalaniz
Copy link
Contributor

aaalaniz commented Mar 4, 2020

Hey @DmytroBatyuk

Thank you for the detailed steps and workaround. I have filed a bug and we will get this fixed in the next release.

Thanks!

@paynerc
Copy link
Contributor

paynerc commented Mar 20, 2020

All,

I am actively trying to debug this issue. Are you able to reproduce it with any of the Quickstart applications or is this only happening in your own applications?

Do you have steps that actively cause this issue to occur? As of now, I am unable to cause the crash to occur.

Thank you,

Ryan

@paynerc
Copy link
Contributor

paynerc commented Mar 23, 2020

All,

It turns out my earlier testing was a bit flawed and I was easily able to reproduce this issue with an integration test. I have addressed the issue and hope to get it into a release soon.

Thank you for your patience while working through this issue.

Ryan

@paynerc
Copy link
Contributor

paynerc commented Mar 31, 2020

This crash was resolved in the 5.3.0 release of the Android SDK.

@paynerc paynerc closed this as completed Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants