BelledonneCommunications / linphone-sdk

Mirror for linphone-sdk (https://gitlab.linphone.org/BC/public/linphone-sdk.git)
GNU Affero General Public License v3.0
105 stars 81 forks source link

When the freeswitch server initiates a conference call, ANR occurs on the terminal #375

Open LoyaiHai opened 8 months ago

LoyaiHai commented 8 months ago

Hi @Viish When I am testing linphone, this problem occurs: the freeswitch server initiates a meeting. When the Java background service sends a pull request to freeswitch, MicSip is on the Windows server, so it receives an account invitation from the freeswitch server. However, when the Android device terminal, ANR phenomenon occurs, the Android application interface thread is blocked for a long time, will trigger the "application no response" (ANR) error. What's the reason for this, please? At the same time, I would like to know how linphone can implement the same as Java, through Socket connection, listen to the Event event, to receive the event sent by the freeswitch server? Thank you cheers

Viish commented 8 months ago

Hi @LoyaiHai,

For the ANR, please attach the tombstone. For the event sent by your conference server it depends what is it. Is it part of any SIP RFC, is it custom but using SIP protocol, etc...

Cheers,

LoyaiHai commented 8 months ago

Hi @Viish

First question: What is a tombstone? Second question: I downloaded your latest source code from github, please ask how to add tombstones? Thank you cheers

Viish commented 8 months ago

A tombstone is a file generated by your Android when such ANR occurs. You can fetch it from the device using adb bugreport command on a computer connected to the device (it generates a .zip with many files including logs & the tombstone).

LoyaiHai commented 8 months ago

Hi @Viish please look this: linphoneconference.txt

LoyaiHai commented 8 months ago

and the logcat screen: QQ截图20240124154412 Thank you cheers

Viish commented 8 months ago

There's no ANR tombstone in the file you attached, and the error logs you screenshot aren't related to the ANR either...

LoyaiHai commented 8 months ago

Hi @Viish Here is the zip file I generated using: adb bugreport: bugreport-RT-08MF-QP1A.190711.020-2024-01-24-16-02-03.zip Thank you cheers

Viish commented 8 months ago

Thanks. Here's what's causing the ANR:

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x71764988 self=0x70c1e04c00
  | sysTid=15150 nice=-10 cgrp=default sched=0/0 handle=0x70c3370ed0
  | state=S schedstat=( 3548572867 116573085 2156 ) utm=329 stm=24 core=6 HZ=100
  | stack=0x7fe8786000-0x7fe8788000 stackSize=8192KB
  | held mutexes=
  kernel: (couldn't read /proc/self/task/15150/stack)
  native: #00 pc 00000000000ce584  /apex/com.android.runtime/lib64/bionic/libc.so (read+4)
  native: BelledonneCommunications/linphone-android#1 pc 00000000000d9ef0  /apex/com.android.runtime/lib64/bionic/libc.so (__sread+40)
  native: BelledonneCommunications/linphone-android#2 pc 00000000000d9dec  /apex/com.android.runtime/lib64/bionic/libc.so (__srefill+268)
  native: BelledonneCommunications/linphone-android#3 pc 00000000000de040  /apex/com.android.runtime/lib64/bionic/libc.so (fread_unlocked+200)
  native: BelledonneCommunications/linphone-android#4 pc 00000000000ddf30  /apex/com.android.runtime/lib64/bionic/libc.so (fread+72)
  native: BelledonneCommunications/linphone-android#5 pc 0000000000099840  /apex/com.android.runtime/lib64/bionic/libc.so (android_getaddrinfofornetcontext+2424)
  native: BelledonneCommunications/linphone-android#6 pc 0000000000098ea0  /apex/com.android.runtime/lib64/bionic/libc.so (android_getaddrinfofornet+56)
  native: BelledonneCommunications/linphone-android#7 pc 000000000007224c  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!libbctoolbox.so (offset ec8000) (bctbx_get_local_ip_for+216)
  native: BelledonneCommunications/linphone-android#8 pc 0000000000cd0134  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::MediaSessionPrivate::getLocalIpFromRemote(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&) const+204)
  native: BelledonneCommunications/linphone-android#9 pc 0000000000cd03d4  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::MediaSessionPrivate::getLocalIpFromMedia() const+280)
  native: BelledonneCommunications/linphone-android#10 pc 0000000000cd0bc4  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::MediaSessionPrivate::getMediaLocalIp() const+220)
  native: BelledonneCommunications/linphone-android#11 pc 0000000000cc8f28  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::MediaSessionPrivate::makeLocalMediaDescription(bool, bool, bool, bool)+788)
  native: BelledonneCommunications/linphone-android#12 pc 0000000000cdf87c  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::MediaSession::configure(_LinphoneCallDir, std::__ndk1::shared_ptr<LinphonePrivate::Account> const&, LinphonePrivate::SalCallOp*, std::__ndk1::shared_ptr<LinphonePrivate::Address const> const&, std::__ndk1::shared_ptr<LinphonePrivate::Address const> const&)+748)
  native: BelledonneCommunications/linphone-android#13 pc 0000000000c678b4  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::Call::Call(std::__ndk1::shared_ptr<LinphonePrivate::Core>, _LinphoneCallDir, std::__ndk1::shared_ptr<LinphonePrivate::Address const> const&, std::__ndk1::shared_ptr<LinphonePrivate::Address const> const&, std::__ndk1::shared_ptr<LinphonePrivate::Account> const&, LinphonePrivate::SalCallOp*, LinphonePrivate::MediaSessionParams const*)+648)
  native: BelledonneCommunications/linphone-android#14 pc 0000000000c31c3c  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (_ZN8bellesip12HybridObjectI13_LinphoneCallN15LinphonePrivate4CallEE13createCObjectIS3_JNSt6__ndk110shared_ptrINS2_4CoreEEE16_LinphoneCallDirNS7_IKNS2_7AddressEEESD_DnRPNS2_9SalCallOpEDnEEEPS1_DpOT0_+120)
  native: BelledonneCommunications/linphone-android#15 pc 0000000000c31ac0  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (linphone_call_new_incoming+220)
  native: BelledonneCommunications/linphone-android#16 pc 0000000000b22c5c  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (???)
  native: BelledonneCommunications/linphone-android#17 pc 0000000000d9a72c  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::SalCallOp::processRequestEventCb(void*, belle_sip_request_event const*)+3556)
  native: BelledonneCommunications/linphone-android#18 pc 0000000000da9d50  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (LinphonePrivate::Sal::processRequestEventCb(void*, belle_sip_request_event const*)+3316)
  native: BelledonneCommunications/linphone-android#19 pc 0000000000f0ee68  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (belle_sip_provider_dispatch_message+728)
  native: BelledonneCommunications/linphone-android#20 pc 0000000000ef6880  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (???)
  native: BelledonneCommunications/linphone-android#21 pc 0000000000ef4f00  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (belle_sip_channel_process_data+316)
  native: BelledonneCommunications/linphone-android#22 pc 0000000000f1a814  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (???)
  native: BelledonneCommunications/linphone-android#23 pc 0000000000eeaba8  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (belle_sip_main_loop_run+972)
  native: BelledonneCommunications/linphone-android#24 pc 0000000000eeadec  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (belle_sip_main_loop_sleep+68)
  native: BelledonneCommunications/linphone-android#25 pc 0000000000b3e288  /data/app/org.linphone.debug-S1JxxL8_m7vIMsn7QfXXwQ==/base.apk!liblinphone.so (offset 1a42000) (linphone_core_iterate+444)

@AndreaGianarda any idea?

LoyaiHai commented 8 months ago

Hi @Viish Excuse me, is this my problem? What do I need to do here?

Viish commented 8 months ago

Excuse me, is this my problem? What do I need to do here?

No it's not your fault, it's an issue in our SDK, for some reason the call to bctbx_get_local_ip_for is blocking and causes the ANR. We'll have to find a way to prevent that in our SDK.

LoyaiHai commented 8 months ago

Hi @Viish When I install your official APK here, there is no such problem, you can refer to this official APK:org.linphone_510403.apk

Viish commented 8 months ago

When I install your official APK here, there is no such problem, you can refer to this official APK:org.linphone_510403.apk

Yes because it's an old release. If you use latest one (https://download.linphone.org/releases/android/linphone-android-5.2.2.apk) I'm quite sure you'll also have it.

LoyaiHai commented 8 months ago

Hi @Viish That's awkward, does it mean that I can use the SDK that was fine before it was solved?

Then may I ask, if it is an aar package, which version of the package is no problem?

Thank you cheers

Viish commented 8 months ago

I don't know exactly which version of 5.3.x SDK brought the issue, but if you can stay on 5.2 SDK for now it should prevent this ANR.

LoyaiHai commented 8 months ago

Hi @Viish OK,i got it,Can the above problem be solved in the near future? Can you give me an approximate time, I can plan the time

Thank you cheers