I started with the BLE provisioning sample (ncs\v2.7.0\nrf\samples\wifi\provisioning\ble) using nrf7002dk/nrf5340/cpuapp build target with sysbuild which works fine to provision WiFi credentials, then added in the AWS IoT sample (ncs\v2.7.0\nrf\samples\net\aws_iot) which completes IP allocation and certificate provisioning before hitting an error with mqtt_client_tls_connect() and zsock_socket().
It appears that zsock_socket is not able to allocate a socket properly and returns a -1. Could this be a memory issue? Prj.conf included below based on the two samples along with relevant log.
prj.conf
Log
*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.660,125] <inf> net_config: Initializing network
[00:00:00.660,156] <inf> net_config: Waiting interface 1 (0x20001180) to be up...
[00:00:00.660,400] <inf> net_config: IPv4 address: 192.165.100.150
[00:00:00.660,430] <inf> net_config: Running dhcpv4 client...
[00:00:00.665,771] <dbg> net_sock_svc: socket_service_thread: (0x20002bd8): Service WEST_TOPDIR/zephyr/subsys/net/lib/dns/resolve.c:70 has 1 pollable sockets
[00:00:00.665,771] <dbg> net_sock_svc: socket_service_thread: (0x20002bd8): Monitoring 1 socket entries
[00:00:00.665,832] <dbg> net_sock_svc: socket_service_thread: Socket service thread RESTART - k_mutex_lock
[00:00:00.665,832] <dbg> net_sock_svc: socket_service_thread: Socket service thread RESTART - k_mutex_unlock
[00:00:00.674,133] <wrn> net_sock: ret: 8
[00:00:00.811,614] <dbg> mqtt_helper: mqtt_helper_poll_loop: Waiting for connection_poll_sem
[00:00:01.690,917] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:01.690,948] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
[00:00:01.690,979] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:01.727,172] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x21fb, manufacturer 0x0059
[00:00:01.727,203] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x21fb
[00:00:01.727,233] <inf> ble_provision: Bluetooth initialized.
[00:00:01.727,233] <inf> ble_provision: Wi-Fi provisioning service starts successfully.
[00:00:01.727,264] <inf> ble_provision: update_dev_name to: AO1001C82
[00:00:01.729,431] <inf> ble_provision: BT Advertising successfully started.
[00:00:39.557,281] <wrn> ble_provision: BT Connected
[00:00:40.064,483] <wrn> bt_l2cap: Ignoring data for unknown channel ID 0x003a
[00:00:42.104,766] <inf> ble_provision: BT pairing completed
[00:00:42.104,919] <inf> ble_provision: BT Security changed
[00:00:42.134,735] <inf> wifi_prov: Wi-Fi Provisioning service - data out: notifications enabled
[00:00:42.284,729] <inf> wifi_prov: Wi-Fi Provisioning service - control point: indications enabled
[00:00:42.404,937] <inf> wifi_prov: Start parsing...
[00:00:42.404,968] <inf> wifi_prov: GET_STATUS received...
[00:00:43.455,230] <inf> wifi_prov: Start parsing...
[00:00:43.455,261] <inf> wifi_prov: Start_Scan received...
[00:01:01.530,120] <inf> wifi_prov: Start parsing...
[00:01:01.530,181] <inf> wifi_prov: Set_config received...
[00:01:04.364,685] <dbg> net_sock_packet: zpacket_received_cb: (0x20002dc8): ctx=0x2000497c, pkt=0x200474d0, st=0, user_data=0
[00:01:04.379,486] <dbg> net_sock_packet: zpacket_received_cb: (0x20002dc8): ctx=0x2000497c, pkt=0x20047510, st=0, user_data=0
[00:01:04.405,273] <wrn> ble_provision: Connected to a Wi-Fi Network!
[00:01:04.500,183] <inf> wifi_prov: Start parsing...
[00:01:04.500,244] <inf> wifi_prov: GET_STATUS received...
[00:01:07.427,551] <dbg> net_sock_packet: zpacket_received_cb: (0x20002dc8): ctx=0x2000497c, pkt=0x200474d0, st=0, user_data=0
[00:01:07.427,856] <wrn> net_sock: sock_family->is_supported
[00:01:07.427,917] <dbg> net_sock: zsock_socket_internal: (0x20002dc8): socket: ctx=0x20004a24, fd=13
[00:01:07.427,947] <wrn> net_sock: ret: 13
[00:01:07.439,514] <dbg> net_sock_packet: zpacket_received_cb: (0x20002dc8): ctx=0x2000497c, pkt=0x20047510, st=0, user_data=0
[00:01:07.439,849] <inf> net_dhcpv4: Received: 192.168.1.38
[00:01:07.440,032] <inf> net_config: IPv4 address: 192.168.1.38
[00:01:07.440,063] <inf> net_config: Lease time: 86400 seconds
[00:01:07.440,093] <inf> net_config: Subnet: 255.255.255.0
[00:01:07.440,155] <inf> net_config: Router: 192.168.1.1
metal: warning: tx_vq: freeing non-empty virtqueue
metal: warning: rx_vq: freeing non-empty virtqueue
[00:01:09.450,225] <inf> wifi_prov: Wi-Fi Provisioning service - control point: indications disabled
[00:01:09.450,286] <inf> wifi_prov: Wi-Fi Provisioning service - data out: notifications disabled
[00:01:09.450,378] <inf> ble_provision: BT Disconnected
[00:01:09.450,439] <wrn> ble_provision: bt_disabled!
[00:01:09.450,469] <inf> aws_iot_c: The AWS IoT sample started, version: v1.1.1
[00:01:09.450,531] <wrn> aws_iot_c: Network connectivity established
[00:01:09.450,561] <inf> aws_iot_c: l4_event_handler triggered!
[00:01:09.450,622] <inf> conn_mgr: conn_mgr_mon_resend_status
[00:01:09.450,622] <inf> aws_iot_c: Bringing network interface up and connecting to the network
[00:01:09.450,714] <dbg> mqtt_helper: mqtt_state_set: State transition: MQTT_STATE_UNINIT --> MQTT_STATE_DISCONNECTED
[00:01:09.450,714] <inf> aws_iot_c: aws_iot_client_init completed
[00:01:14.450,622] <inf> aws_iot_c: Connecting to AWS IoT
[00:01:14.450,775] <dbg> aws_iot: aws_iot_connect: No hostname provided, using Kconfig value: xxx.amazonaws.com
[00:01:14.450,805] <dbg> aws_iot: aws_iot_connect: No device ID provided, using Kconfig value: nrf7002
[00:01:14.450,866] <dbg> aws_iot: shadow_topics_construct: get_topic: $aws/things/nrf7002/shadow/get
[00:01:14.450,897] <dbg> aws_iot: shadow_topics_construct: update_topic: $aws/things/nrf7002/shadow/update
[00:01:14.450,958] <dbg> aws_iot: shadow_topics_construct: delete_topic: $aws/things/nrf7002/shadow/delete
[00:01:14.450,988] <dbg> net_mqtt: mqtt_client_init: mqtt_client_init completed
[00:01:14.451,019] <dbg> mqtt_helper: broker_init: Resolving IP address for xxx.amazonaws.com
[00:01:14.451,110] <dbg> net_sock_addr: exec_query: (0x20003bf0): Timeout 2000
[00:01:14.451,232] <dbg> net_dns_resolve: dns_resolve_name: (0x20003bf0): DNS id will be 27827
[00:01:14.451,354] <dbg> net_dns_resolve: dns_write: (0x20003bf0): [0] submitting work to server idx 0 for id 27827 hash 1971
[00:01:14.492,340] <dbg> net_sock_packet: zpacket_received_cb: (0x20002dc8): ctx=0x2000497c, pkt=0x200474d0, st=0, user_data=0
[00:01:14.492,492] <dbg> net_sock: zsock_received_cb: (0x20002dc8): ctx=0x20004a24, pkt=0x20047510, st=0, user_data=0
[00:01:14.602,203] <dbg> net_sock_svc: socket_service_thread: (0x20002bd8): Received restart event.
[00:01:14.602,233] <dbg> net_sock_svc: socket_service_thread: Socket service thread RESTART - k_mutex_lock
[00:01:14.602,264] <dbg> net_sock_svc: socket_service_thread: Socket service thread RESTART - k_mutex_unlock
[00:01:14.602,539] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,569] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,569] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,600] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): getaddrinfo entries overflow
[00:01:14.602,600] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,600] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): getaddrinfo entries overflow
[00:01:14.602,630] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,661] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): getaddrinfo entries overflow
[00:01:14.602,691] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,691] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): getaddrinfo entries overflow
[00:01:14.602,691] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,722] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): getaddrinfo entries overflow
[00:01:14.602,722] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -100
[00:01:14.602,752] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): getaddrinfo entries overflow
[00:01:14.602,752] <dbg> net_sock_addr: dns_resolve_cb: (0x20002bd8): dns status: -103
[00:01:14.602,844] <dbg> mqtt_helper: broker_init: IPv4 Address found XX.X.XXX.XXX (AF_INET)
[00:01:14.602,874] <dbg> mqtt_helper: broker_init: broker_init completed with err: 0
[00:01:14.602,905] <dbg> mqtt_helper: client_connect: broker_init success
[00:01:14.602,905] <dbg> mqtt_helper: certificates_provision: certificates_provision started
[00:01:14.602,935] <wrn> mqtt_helper: Certificates Provisioned Successfully!
[00:01:14.602,966] <dbg> mqtt_helper: mqtt_state_set: State transition: MQTT_STATE_DISCONNECTED --> MQTT_STATE_TRANSPORT_CONNECTING
[00:01:14.602,996] <dbg> net_mqtt: mqtt_connect: mqtt_mutex_lock(client)
[00:01:14.602,996] <wrn> net_mqtt_sock_tls: mqtt_client_tls_connect STARTED
[00:01:14.603,027] <wrn> net_sock: ret: -1
[00:01:14.603,057] <dbg> net_mqtt_sock_tls: mqtt_client_tls_connect: (0x20003bf0): client->transport.tls.sock = -1; broker->sa_family: 1, type: 1
[00:01:14.603,057] <err> net_mqtt: mqtt_transport_connect err_code: -123
[00:01:14.603,057] <dbg> net_mqtt: mqtt_connect: client_connect err_code: -123
[00:01:14.603,088] <err> mqtt_helper: mqtt_connect, error: -123
[00:01:14.603,118] <dbg> mqtt_helper: mqtt_state_set: State transition: MQTT_STATE_TRANSPORT_CONNECTING --> MQTT_STATE_DISCONNECTED
[00:01:14.603,118] <err> aws_iot: mqtt_helper_connect, error: -123
[00:01:14.603,149] <inf> aws_iot_c: AWS Iot Connect failed (err: -123), Next connection retry in 30 seconds
[00:01:14.603,302] <err> net_dns_resolve: DNS recv error (-103)