avs-device-sdk icon indicating copy to clipboard operation
avs-device-sdk copied to clipboard

Alexa SDK crashes in libcurl

Open pavlonadolynskyi opened this issue 3 years ago • 4 comments

Briefly summarize your issue:

iOS app crashes in the background in the libcurl part.

What is the expected behavior?

Not to crash in the background.

What behavior are you observing?

App with Alexa SDK running sometimes crash when resources (like the internet connection) are limited by the system while the app is running in the background. Crash reports samples that we get:

Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4308320256
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   100cbc000-101fac000 [ 18.9M] r-x/r-x SM=COW  ...Demo.app/Demo

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [910]
Triggered by Thread:  33

...

Thread 33 Crashed:
0   libsystem_pthread.dylib       	0x00000001d5aefb3c pthread_rwlock_rdlock$VARIANT$mp + 0 (inline_internal.h:87)
1   AVS                           	0x0000000103b8e934 CRYPTO_THREAD_read_lock + 24
2   AVS                           	0x0000000103af3f38 int_err_get_item + 44
3   AVS                           	0x0000000103af3c78 ERR_lib_error_string + 144
4   AVS                           	0x0000000103af3a40 ERR_error_string_n + 88
5   AVS                           	0x00000001040728b8 ossl_strerror + 32
6   AVS                           	0x0000000104073234 ossl_connect_common + 1928
7   AVS                           	0x000000010407726c Curl_ssl_connect_nonblocking + 120
8   AVS                           	0x000000010404bee4 https_connecting + 28
9   AVS                           	0x000000010404be80 Curl_http_connect + 324
10  AVS                           	0x000000010405a434 multi_runsingle + 1072
11  AVS                           	0x0000000104059f10 curl_multi_perform + 152
12  AVS                           	0x0000000103e18878 alexaClientSDK::avsCommon::utils::libcurlUtils::CurlMultiHandleWrapper::perform(int*) + 48
13  AVS                           	0x0000000103e1e9f0 alexaClientSDK::avsCommon::utils::libcurlUtils::LibcurlHTTP2Connection::networkLoop() + 372
14  AVS                           	0x0000000103e21330 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (alexaClientSDK::avsCommon::utils::libcurl... + 64
15  libsystem_pthread.dylib       	0x00000001d5af7c9c _pthread_start + 288 (pthread.c:881)
16  libsystem_pthread.dylib       	0x00000001d5afc880 thread_start + 8
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4376477696
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   104dbc000-1060ac000 [ 18.9M] r-x/r-x SM=COW  ...Demo.app/Demo

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [12078]
Triggered by Thread:  28

...

Thread 28 Crashed:
0   libsystem_pthread.dylib       	0x00000001f259326c _pthread_rwlock_lock_wait + 352 (pthread_rwlock.c:662)
1   AVS                           	0x0000000107c92934 CRYPTO_THREAD_read_lock + 24
2   AVS                           	0x0000000107bf7f38 int_err_get_item + 44
3   AVS                           	0x0000000107bf7c78 ERR_lib_error_string + 144
4   AVS                           	0x0000000107bf7a40 ERR_error_string_n + 88
5   AVS                           	0x00000001081768b8 ossl_strerror + 32
6   AVS                           	0x0000000108177234 ossl_connect_common + 1928
7   AVS                           	0x000000010817b26c Curl_ssl_connect_nonblocking + 120
8   AVS                           	0x000000010814fee4 https_connecting + 28
9   AVS                           	0x000000010814fe80 Curl_http_connect + 324
10  AVS                           	0x000000010815e434 multi_runsingle + 1072
11  AVS                           	0x000000010815df10 curl_multi_perform + 152
12  AVS                           	0x0000000107f1c878 alexaClientSDK::avsCommon::utils::libcurlUtils::CurlMultiHandleWrapper::perform(int*) + 48
13  AVS                           	0x0000000107f229f0 alexaClientSDK::avsCommon::utils::libcurlUtils::LibcurlHTTP2Connection::networkLoop() + 372
14  AVS                           	0x0000000107f25330 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (alexaClientSDK::avsCommon::utils::libcurl... + 64
15  libsystem_pthread.dylib       	0x00000001f258bcb0 _pthread_start + 320 (pthread.c:881)
16  libsystem_pthread.dylib       	0x00000001f2594778 thread_start + 8
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4371890176
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   10495c000-105c4c000 [ 18.9M] r-x/r-x SM=COW  ...Demo.app/Demo

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [22047]
Triggered by Thread:  32

...

Thread 32 Crashed:
0   libsystem_pthread.dylib       	0x00000001e57a326c pthread_rwlock_rdlock + 0 (inline_internal.h:87)
1   AVS                           	0x0000000107832934 CRYPTO_THREAD_read_lock + 24
2   AVS                           	0x0000000107797f38 int_err_get_item + 44
3   AVS                           	0x0000000107797c78 ERR_lib_error_string + 144
4   AVS                           	0x0000000107797a40 ERR_error_string_n + 88
5   AVS                           	0x0000000107d168b8 ossl_strerror + 32
6   AVS                           	0x0000000107d17234 ossl_connect_common + 1928
7   AVS                           	0x0000000107d1b26c Curl_ssl_connect_nonblocking + 120
8   AVS                           	0x0000000107cefee4 https_connecting + 28
9   AVS                           	0x0000000107cefe80 Curl_http_connect + 324
10  AVS                           	0x0000000107cfe434 multi_runsingle + 1072
11  AVS                           	0x0000000107cfdf10 curl_multi_perform + 152
12  AVS                           	0x0000000107abc878 alexaClientSDK::avsCommon::utils::libcurlUtils::CurlMultiHandleWrapper::perform(int*) + 48
13  AVS                           	0x0000000107ac29f0 alexaClientSDK::avsCommon::utils::libcurlUtils::LibcurlHTTP2Connection::networkLoop() + 372
14  AVS                           	0x0000000107ac5330 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (alexaClientSDK::avsCommon::utils::libcurl... + 64
15  libsystem_pthread.dylib       	0x00000001e579bcb0 _pthread_start + 320 (pthread.c:881)
16  libsystem_pthread.dylib       	0x00000001e57a4778 thread_start + 8

Provide the steps to reproduce the issue, if applicable:

Crashes are very unstable to reproduce, but they happen in background mode.

Tell us about your environment:

iOS devices that use Alexa SDK as a compiled library.

What version of the AVS Device SDK are you using?

1.20.0

Tell us what hardware you're using:

  • [ ] Desktop / Laptop
  • [ ] Raspberry Pi
  • [x] Other - tell us more: iPhone, iPad

Tell us about your OS (Type & version):

  • [ ] Linux
  • [ ] MacOS
  • [ ] Raspbian Stretch
  • [ ] Raspbian Jessy
  • [x] Other - tell us more: iOS 12+

pavlonadolynskyi avatar Apr 21 '21 14:04 pavlonadolynskyi

Hi @pavlonadolynskyi,

Thank you for pointing this out. We are investigating the issue internally.

kjkh avatar Apr 24 '21 00:04 kjkh

@kjkh do you have any news?

pavlonadolynskyi avatar Jun 09 '21 14:06 pavlonadolynskyi

@kjkh Hi, could you pls update me on progress?

pavlonadolynskyi avatar Jul 27 '21 12:07 pavlonadolynskyi

Hi @pavlonadolynskyi what is the curl version that are you using? I have the same problem with curl version 7.75.0 and I resolved it by regressing to version 7.69.1

nad81 avatar Oct 26 '21 12:10 nad81

I think this issue is resolved by downgrading the version of libcurl as mentioned. If you have further questions, please open a new ticket and refer to this closed one.

kclchan avatar Sep 08 '22 16:09 kclchan