Mbedtls, sending content via mqtt5

glopets
Posts: 1
Joined: Tue Oct 31, 2023 2:17 pm

Mbedtls, sending content via mqtt5

Postby glopets » Tue Oct 31, 2023 2:23 pm

hello,

Im using the esp32s3 mcu using esp-idf5.1.1, i send data to a server through mqtt5.
currently around 80% of the content that i send to the server is arriving, yet, i get repeatedly this error message:

transport_base: esp_tls_conn_read error, errno=Socket is not connected
mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=128
[MQTT]: EVENT: MQTT_EVENT_ERROR
mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -1

i’ve set the environment to debug mbedtls through menuconfig, and i noticed that at the last stage of the protocol “handshake wrap up ” it seems to always fail(not sure this is valid or not) this is the content:

e[0;32mI (632817) mbedtls: ssl_tls.c:3859 client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP
e[0m
e[0;32mI (632847) mbedtls: ssl_tls.c:3950 <= handshake
e[0m
e[0;32mI (632857) mbedtls: ssl_msg.c:5701 => write
e[0m
e[0;32mI (632877) mbedtls: ssl_msg.c:2714 => write record
e[0m
e[0;32mI (632897) mbedtls: ssl_msg.c:715 => encrypt buf
e[0m
e[0;32mI (632907) mbedtls: ssl_msg.c:1256 <= encrypt buf
e[0m
e[0;32mI (632927) mbedtls: ssl_msg.c:2124 => flush output
e[0m
e[0;32mI (632947) mbedtls: ssl_msg.c:2138 message length: 58, out_left: 58
e[0m
e[0;32mI (632967) mbedtls: ssl_msg.c:2145 ssl->f_send() returned 58 (-0xffffffc6)
e[0m
e[0;32mI (632987) mbedtls: ssl_msg.c:2172 <= flush output
e[0m
e[0;32mI (633007) mbedtls: ssl_msg.c:2851 <= write record
e[0m
e[0;32mI (633017) mbedtls: ssl_msg.c:5723 <= write
e[0m
e[0;32mI (633707) mbedtls: ssl_msg.c:5441 => read
e[0m
e[0;32mI (633707) mbedtls: ssl_msg.c:3887 => read record
e[0m
e[0;32mI (633707) mbedtls: ssl_msg.c:1926 => fetch input
e[0m
e[0;32mI (633727) mbedtls: ssl_msg.c:2066 in_left: 0, nb_want: 5
e[0m
e[0;32mI (633747) mbedtls: ssl_msg.c:2086 in_left: 0, nb_want: 5
e[0m
e[0;32mI (633767) mbedtls: ssl_msg.c:2089 ssl->f_recv(_timeout)() returned 5 (-0xfffffffb)
e[0m
e[0;32mI (633787) mbedtls: ssl_msg.c:2111 <= fetch input
e[0m
e[0;32mI (633807) mbedtls: ssl_msg.c:1926 => fetch input
e[0m
e[0;32mI (633827) mbedtls: ssl_msg.c:2066 in_left: 5, nb_want: 33
e[0m
e[0;32mI (633837) mbedtls: ssl_msg.c:2086 in_left: 5, nb_want: 33
e[0m
e[0;32mI (633857) mbedtls: ssl_msg.c:2089 ssl->f_recv(_timeout)() returned 28 (-0xffffffe4)
e[0m
e[0;32mI (633887) mbedtls: ssl_msg.c:2111 <= fetch input
e[0m
e[0;32mI (633907) mbedtls: ssl_msg.c:1291 => decrypt buf
e[0m
e[0;32mI (633917) mbedtls: ssl_msg.c:1892 <= decrypt buf
e[0m
e[0;32mI (633937) mbedtls: ssl_msg.c:3959 <= read record
e[0m
e[0;32mI (633957) mbedtls: ssl_msg.c:5620 <= read
e[0m
e[0;32mI (633967) mbedtls: ssl_msg.c:5441 => read
e[0m
e[0;32mI (633987) mbedtls: ssl_msg.c:5620 <= read
e[0m
e[0;32mI (633997) mbedtls: ssl_msg.c:5441 => read
e[0m
e[0;32mI (634017) mbedtls: ssl_msg.c:5620 <= read
e[0m
e[0;32mI (634727) mbedtls: ssl_msg.c:5441 => read
e[0m
e[0;32mI (634737) mbedtls: ssl_msg.c:3887 => read record
e[0m
e[0;32mI (634737) mbedtls: ssl_msg.c:1926 => fetch input
e[0m
e[0;32mI (634747) mbedtls: ssl_msg.c:2066 in_left: 0, nb_want: 5
e[0m
e[0;32mI (634767) mbedtls: ssl_msg.c:2086 in_left: 0, nb_want: 5
e[0m
e[0;32mI (634787) mbedtls: ssl_msg.c:2089 ssl->f_recv(_timeout)() returned 5 (-0xfffffffb)
e[0m
e[0;32mI (634807) mbedtls: ssl_msg.c:2111 <= fetch input
e[0m
e[0;32mI (634827) mbedtls: ssl_msg.c:1926 => fetch input
e[0m
e[0;32mI (634847) mbedtls: ssl_msg.c:2066 in_left: 5, nb_want: 31
e[0m
e[0;32mI (634867) mbedtls: ssl_msg.c:2086 in_left: 5, nb_want: 31
e[0m
e[0;32mI (634877) mbedtls: ssl_msg.c:2089 ssl->f_recv(_timeout)() returned 26 (-0xffffffe6)
e[0m
e[0;32mI (634907) mbedtls: ssl_msg.c:2111 <= fetch input
e[0m
e[0;32mI (634927) mbedtls: ssl_msg.c:1291 => decrypt buf
e[0m
e[0;32mI (634937) mbedtls: ssl_msg.c:1892 <= decrypt buf
e[0m
e[0;32mI (634957) mbedtls: ssl_msg.c:4792 got an alert message, type: [1:0]
e[0m
e[0;32mI (634977) mbedtls: ssl_msg.c:4806 is a close notify message
e[0m
e[0;33mW (634997) mbedtls: ssl_msg.c:3942 mbedtls_ssl_handle_message_type() returned -30848 (-0x7880)
e[0m
e[0;33mW (635027) mbedtls: ssl_msg.c:5501 mbedtls_ssl_read_record() returned -30848 (-0x7880)
e[0m
e[0;32mI (636437) mbedtls: ssl_msg.c:5441 => read
e[0m
e[0;32mI (636437) mbedtls: ssl_msg.c:3887 => read record
e[0m
e[0;32mI (636437) mbedtls: ssl_msg.c:1926 => fetch input
e[0m
e[0;32mI (636447) mbedtls: ssl_msg.c:2066 in_left: 0, nb_want: 5
e[0m
e[0;32mI (636467) mbedtls: ssl_msg.c:2086 in_left: 0, nb_want: 5
e[0m
e[0;32mI (636487) mbedtls: ssl_msg.c:2089 ssl->f_recv(_timeout)() returned 0 (-0x0000)
e[0m
e[0;33mW (636517) mbedtls: ssl_msg.c:4561 mbedtls_ssl_fetch_input() returned -29312 (-0x7280)
e[0m
e[0;33mW (636537) mbedtls: ssl_msg.c:3918 ssl_get_next_record() returned -29312 (-0x7280)
e[0m
e[0;32mI (636567) mbedtls: ssl_msg.c:5441 => read
e[0m
e[0;32mI (636577) mbedtls: ssl_msg.c:3887 => read record
e[0m
e[0;32mI (636597) mbedtls: ssl_msg.c:1926 => fetch input
e[0m
e[0;32mI (636617) mbedtls: ssl_msg.c:2066 in_left: 0, nb_want: 5
e[0m
e[0;32mI (636627) mbedtls: ssl_msg.c:2086 in_left: 0, nb_want: 5
e[0m
e[0;32mI (636647) mbedtls: ssl_msg.c:2089 ssl->f_recv(_timeout)() returned -76 (-0x004c)
e[0m
e[0;33mW (636677) mbedtls: ssl_msg.c:4561 mbedtls_ssl_fetch_input() returned -76 (-0x004c)
e[0m
e[0;33mW (636697) mbedtls: ssl_msg.c:3918 ssl_get_next_record() returned -76 (-0x004c)
e[0m
e[0;33mW (636727) mbedtls: ssl_msg.c:5501 mbedtls_ssl_read_record() returned -76 (-0x004c)
e[0;31mE (636747) esp-tls-mbedtls: read error :-0x004C:e[0m
e[0;31mE (636767) transport_base: esp_tls_conn_read error, errno=Socket is not connectede[0m
e[0;31mE (636787) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=128e[0m
e[0;31mE (636817) mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -1e[0m

this happens every seconds 20±.
im no expert on mqtt or tls, have someone came across this problem or, anyone might know if this can reflect on the only 80% of the messages are received?


also after a while i might receive this message all of the sudden and the communication with the server cannot be reestablished until i reset the device:
(14578137) esp-tls: couldn't get hostname for :a12q864vmj05v3-ats.iot.us-east-1.amazonaws.com: getaddrinfo() returns 202, addrinfo=0x0
(14578137) esp-tls: Failed to open new connection
(14578157) transport_base: Failed to open a new connection
(14578177) mqtt_client: Error transport connect

help is much appreciated!

Who is online

Users browsing this forum: No registered users and 108 guests