aws / aws-iot-device-sdk-java-v2

Next generation AWS IoT Client SDK for Java using the AWS Common Runtime
Apache License 2.0
111 stars 75 forks source link

JNI crash when trying to build Mqtt5Client with proxy on Android #574

Closed pbryniarski-logi closed 3 months ago

pbryniarski-logi commented 3 months ago

Describe the bug

The sdk crashes when I try to build a Mqtt5Client with proxy on Android. No such issue when I don't set HTTP proxy.

Expected Behavior

The sdk should not crash, HTTP proxy should work.

Current Behavior

04-16 10:07:59.534  9593  9652 D tls-handler: [0000007a39ee8cc0] (HRC:8847135353968)  - ctx: Certificate and key have been set, setting them up now.
04-16 10:07:59.536  9593  9652 D tls-handler: [0000007a39ee8cc0] (HRC:8847136715551)  - ctx: Setting ALPN list x-amzn-mqtt-ca
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847136879510)  - id=0x7b13264210: Initializing edge-triggered epoll
04-16 10:07:59.536  9593  9652 D event-loop: [0000007a39ee8cc0] (HRC:8847136889468)  - id=0x7b13264210: Eventfd not available, falling back to pipe for cross-thread notification.
04-16 10:07:59.536  9593  9652 V event-loop: [0000007a39ee8cc0] (HRC:8847136897968)  - id=0x7b13264210: pipe descriptors read 95, write 96.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847136902051)  - id=0x7b13264210: Starting event-loop thread.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847136956718)  - id=0x7b13264690: Initializing edge-triggered epoll
04-16 10:07:59.536  9593  9652 D event-loop: [0000007a39ee8cc0] (HRC:8847136962010)  - id=0x7b13264690: Eventfd not available, falling back to pipe for cross-thread notification.
04-16 10:07:59.536  9593  9652 V event-loop: [0000007a39ee8cc0] (HRC:8847136967301)  - id=0x7b13264690: pipe descriptors read 98, write 99.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847136983676)  - id=0x7b13264690: Starting event-loop thread.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847137020426)  - id=0x7b132639d0: Initializing edge-triggered epoll
04-16 10:07:59.536  9593  9701 I event-loop: [0000007ab113dcc0] (HRC:8847137022843)  - id=0x7b13264210: main loop started
04-16 10:07:59.536  9593  9701 V event-loop: [0000007ab113dcc0] (HRC:8847137051718)  - id=0x7b13264210: subscribing to events on fd 95
04-16 10:07:59.536  9593  9702 I event-loop: [0000007ab103fcc0] (HRC:8847137059385)  - id=0x7b13264690: main loop started
04-16 10:07:59.536  9593  9702 V event-loop: [0000007ab103fcc0] (HRC:8847137083176)  - id=0x7b13264690: subscribing to events on fd 98
04-16 10:07:59.536  9593  9702 I event-loop: [0000007ab103fcc0] (HRC:8847137090176)  - id=0x7b13264690: default timeout 100000, and max events to process per tick 100
04-16 10:07:59.536  9593  9702 V event-loop: [0000007ab103fcc0] (HRC:8847137094343)  - id=0x7b13264690: waiting for a maximum of 100000 ms
04-16 10:07:59.536  9593  9701 I event-loop: [0000007ab113dcc0] (HRC:8847137062385)  - id=0x7b13264210: default timeout 100000, and max events to process per tick 100
04-16 10:07:59.536  9593  9701 V event-loop: [0000007ab113dcc0] (HRC:8847137138676)  - id=0x7b13264210: waiting for a maximum of 100000 ms
04-16 10:07:59.536  9593  9652 D event-loop: [0000007a39ee8cc0] (HRC:8847137025093)  - id=0x7b132639d0: Eventfd not available, falling back to pipe for cross-thread notification.
04-16 10:07:59.536  9593  9652 V event-loop: [0000007a39ee8cc0] (HRC:8847137160885)  - id=0x7b132639d0: pipe descriptors read 101, write 102.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847137165051)  - id=0x7b132639d0: Starting event-loop thread.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847137206010)  - id=0x7b132647b0: Initializing edge-triggered epoll
04-16 10:07:59.536  9593  9652 D event-loop: [0000007a39ee8cc0] (HRC:8847137214926)  - id=0x7b132647b0: Eventfd not available, falling back to pipe for cross-thread notification.
04-16 10:07:59.536  9593  9652 V event-loop: [0000007a39ee8cc0] (HRC:8847137219635)  - id=0x7b132647b0: pipe descriptors read 104, write 105.
04-16 10:07:59.536  9593  9652 I event-loop: [0000007a39ee8cc0] (HRC:8847137222843)  - id=0x7b132647b0: Starting event-loop thread.
04-16 10:07:59.536  9593  9703 I event-loop: [0000007ab0f41cc0] (HRC:8847137260593)  - id=0x7b132639d0: main loop started
04-16 10:07:59.536  9593  9703 V event-loop: [0000007ab0f41cc0] (HRC:8847137269676)  - id=0x7b132639d0: subscribing to events on fd 101
04-16 10:07:59.536  9593  9703 I event-loop: [0000007ab0f41cc0] (HRC:8847137273718)  - id=0x7b132639d0: default timeout 100000, and max events to process per tick 100
04-16 10:07:59.536  9593  9703 V event-loop: [0000007ab0f41cc0] (HRC:8847137276551)  - id=0x7b132639d0: waiting for a maximum of 100000 ms
04-16 10:07:59.536  9593  9704 I event-loop: [0000007ab0e43cc0] (HRC:8847137315718)  - id=0x7b132647b0: main loop started
04-16 10:07:59.536  9593  9704 V event-loop: [0000007ab0e43cc0] (HRC:8847137325385)  - id=0x7b132647b0: subscribing to events on fd 104
04-16 10:07:59.536  9593  9704 I event-loop: [0000007ab0e43cc0] (HRC:8847137330260)  - id=0x7b132647b0: default timeout 100000, and max events to process per tick 100
04-16 10:07:59.536  9593  9704 V event-loop: [0000007ab0e43cc0] (HRC:8847137333051)  - id=0x7b132647b0: waiting for a maximum of 100000 ms
04-16 10:07:59.536  9593  9652 I dns     : [0000007a39ee8cc0] (HRC:8847137333051)  - id=0x7b4326f0d0: Initializing default host resolver with 8 max host entries.
04-16 10:07:59.536  9593  9652 I channel-bootstrap: [0000007a39ee8cc0] (HRC:8847137359343)  - id=0x7b3328d090: Initializing client bootstrap with event-loop group 0x7b23257320
04-16 10:07:59.536  9593  9652 D mqtt5-client: [0000007a39ee8cc0] (HRC:8847137376760)  - java_client=0x7b5324f290: Initializing MQTT5 client
04-16 10:07:59.536  9593  9652 D mqtt5-client: [0000007a39ee8cc0] (HRC:8847137404968)  - JavaHttpProxyOptions=0x7b73259050: Created new JavaHttpProxyOptions
04-16 10:07:59.536  9593  9652 F ogitech.vc.syn: java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: can't call int software.amazon.awssdk.crt.http.HttpProxyOptions$HttpProxyConnectionType.getValue() on instance of software.amazon.awssdk.crt.http.HttpProxyOptions$HttpProxyAuthorizationType
04-16 10:07:59.536  9593  9652 F ogitech.vc.syn: java_vm_ext.cc:577]     in call to CallIntMethod
04-16 10:07:59.536  9593  9652 F ogitech.vc.syn: java_vm_ext.cc:577]     from long software.amazon.awssdk.crt.mqtt5.Mqtt5Client.mqtt5ClientNew(software.amazon.awssdk.crt.mqtt5.Mqtt5ClientOptions, software.amazon.awssdk.crt.mqtt5.packets.ConnectPacket, software.amazon.awssdk.crt.io.ClientBootstrap, software.amazon.awssdk.crt.mqtt5.Mqtt5Client)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655] Runtime aborting...
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655] Dumping all threads without mutator lock held
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655] All threads:
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655] DALVIK THREADS (63):
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655] "pool-8-thread-1" prio=5 tid=45 Runnable
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   | group="" sCount=0 dsCount=0 flags=0 obj=0x14244ad8 self=0x7c332a4eb0
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   | sysTid=9652 nice=0 cgrp=foreground sched=0/0 handle=0x7a39ee8cc0
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   | state=R schedstat=( 11659458 1045918 6 ) utm=0 stm=0 core=3 HZ=100
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   | stack=0x7a39de5000-0x7a39de7000 stackSize=1043KB
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   | held mutexes= "abort lock" "mutator lock"(shared held)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #00 pc 000000000049ee50  /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #01 pc 00000000005abfa8  /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+376)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #02 pc 00000000005c90e0  /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+924)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #03 pc 00000000005c3020  /apex/com.android.art/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+528)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #04 pc 00000000005c21ec  /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+1920)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #05 pc 000000000055ce74  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+1864)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #06 pc 0000000000013978  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #07 pc 0000000000012fa4  /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+320)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #08 pc 00000000003851cc  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+2572)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #09 pc 0000000000385244  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #10 pc 0000000000376f28  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+144)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #11 pc 000000000037a540  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckMethodAndSig(art::ScopedObjectAccess&, _jobject*, _jclass*, _jmethodID*, art::Primitive::Type, art::InvokeType)+1620)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #12 pc 0000000000378db4  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+764)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #13 pc 0000000000366f1c  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallIntMethod(_JNIEnv*, _jobject*, _jmethodID*, ...)+152)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #14 pc 0000000000099370  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk!libaws-crt-jni.so (offset 1819000) (Java_software_amazon_awssdk_crt_mqtt5_Mqtt5Client_mqtt5ClientNew+2852)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #15 pc 000000000013ced4  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #16 pc 00000000001337e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #17 pc 00000000001a8a94  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+228)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #18 pc 0000000000318330  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+376)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #19 pc 000000000030e65c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+996)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #20 pc 000000000067f44c  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+548)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #21 pc 000000000012d994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #22 pc 00000000000a5810  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk (offset 730000) (software.amazon.awssdk.crt.mqtt5.Mqtt5Client.<init>+96)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #23 pc 000000000067ee10  /apex/com.android.art/lib64/libart.so (MterpInvokeDirect+1248)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #24 pc 000000000012d914  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_direct+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #25 pc 00000000000b0ed4  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk (offset 730000) (software.amazon.awssdk.iot.AwsIotMqtt5ClientBuilder.build+176)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #26 pc 000000000067c794  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+1520)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #27 pc 000000000012d814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #28 pc 000000000000d946  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk (offset 4e000) (com.logitech.vc.sync.service.distributor.mqtt.connection.AwsMqttConnectionV2.start+390)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #29 pc 000000000067e1cc  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1808)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #30 pc 000000000012da14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #31 pc 000000000000f3ec  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk (offset 4e000) (com.logitech.vc.sync.service.distributor.mqtt.connection.ThreadSafeMqttConnection$start$2.invokeSuspend+168)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #32 pc 000000000067c794  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+1520)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #33 pc 000000000012d814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #34 pc 0000000000384fe2  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk (offset 2292000) (kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith+42)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #35 pc 000000000067e1cc  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1808)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #36 pc 000000000012da14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #37 pc 00000000003ce038  /data/app/~~IFyqPbROmAW_SaG71jVnrA==/com.logitech.vc.sync-glSzQUyCajMF8kGl_qanXw==/base.apk (offset 2292000) (kotlinx.coroutines.DispatchedTask.run+448)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #38 pc 000000000067e1cc  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1808)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #39 pc 000000000012da14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #40 pc 00000000001f9e6a  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor.runWorker+158)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #41 pc 000000000067c794  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+1520)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #42 pc 000000000012d814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #43 pc 00000000001f8c2c  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor$Worker.run+4)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #44 pc 000000000067e1cc  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1808)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #45 pc 000000000012da14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+20)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #46 pc 00000000000eb7d0  /apex/com.android.art/javalib/core-oj.jar (java.lang.Thread.run+8)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #47 pc 0000000000305c58  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.8100235316906539105)+268)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #48 pc 000000000066b1fc  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+780)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #49 pc 000000000013cff8  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #50 pc 0000000000133564  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #51 pc 00000000001a8a78  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #52 pc 0000000000554c6c  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+460)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #53 pc 00000000005a4008  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1308)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #54 pc 00000000000af8c8  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   native: #55 pc 000000000004fe08  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   at software.amazon.awssdk.crt.mqtt5.Mqtt5Client.mqtt5ClientNew(Native method)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   at software.amazon.awssdk.crt.mqtt5.Mqtt5Client.<init>(Mqtt5Client.java:76)
04-16 10:07:59.581  9593  9652 F ogitech.vc.syn: runtime.cc:655]   at software.amazon.awssdk.iot.AwsIotMqtt5ClientBuilder.build(AwsIotMqtt5ClientBuilder.java:654)

Reproduction Steps

Here's the code I use to build the client:

 val connectProperties = ConnectPacketBuilder()
        connectProperties.withClientId(configuration.clientId)

        val builder: AwsIotMqtt5ClientBuilder = AwsIotMqtt5ClientBuilder.newDirectMqttBuilderWithMtlsFromMemory(
            configuration.endpoint,
            cert,
            key
        ).apply {
            withMaxReconnectDelayMs(configuration.maxReconnectInterval.toLong())
            withLifeCycleEvents(lifecycleEvents)
            withConnectProperties(connectProperties)
            withPublishEvents(publishEvents)
            val options = HttpProxyOptions().apply {
                host = "160.72.98.165"
                port = 3128
            }
            withHttpProxyOptions(options)
        }
        client = builder.build();

Dependency:

 api 'software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk-android:1.20.2'

Please note, without proxy options it does not crash.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.20.2

Environment details (OS name and version, etc.)

Android emulator, API level 30.

bretambrose commented 3 months ago

https://github.com/awslabs/aws-crt-java/pull/779

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

xiazhvera commented 3 months ago

The ticket was automatically closed because the fix PR is merged. However, we still need bring the fix into the SDK. I will update the ticket once the release is out.

xiazhvera commented 3 months ago

The fix is now released in https://github.com/aws/aws-iot-device-sdk-java-v2/releases/tag/v1.20.5. Feel free to reopen the issue if there are further questions.

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

pbryniarski-logi commented 3 months ago

Thanks @xiazhvera @bretambrose. It works for me.