I have been developing an application using the AWS IoT library on build target nrf7002dk/nrf5340/cpuapp and nRF Connect SDK v2.7.0, and the application connects to Wi-Fi shared from my phone. Occasionally it happens that the function call aws_iot_connect never returns, and in the case of a fail I have noticed the following chain of calls.
aws_iot_connect
-> mqtt_helper_connect
-> client_connect
-> mqtt_connect
-> client_connect
-> mqtt_transport_connect
-> mqtt_client_tls_connect
-> zsock_connect
-> z_impl_zsock_connect
-> ztls_connect_ctx
-> tls_mbedtls_handshake with timeout K_FOREVER
-> wait_for_reason with reason MBEDTLS_ERR_SSL_WANT_READ
-> wait with timeout K_FOREVER, ZSOCK_POLLIN
-> zsock_poll
-> z_impls_zsock_poll
-> zsock_poll_internal
-> k_poll,
And k_poll does not return.
Is this something that should be expected to happen occasionally (in which case perhaps a case like this should be handled in nRF Connect SDK code or Zephyr code), or should this be preventable?
