Amazon IOT disconnects and won't reconnect

jrounds
Posts: 15
Joined: Thu Dec 13, 2018 6:11 pm

Amazon IOT disconnects and won't reconnect

Postby jrounds » Thu Dec 13, 2018 6:14 pm

I can send and receive messages from cloud until it drops then it won't reconnect. Some times it will stay connected for hours


I (2761787) wifi: bcn_timout,ap_probe_send_start
I (2764297) wifi: ap_probe_send over, resett wifi status to disassoc
I (2764297) wifi: state: run -> init (100)
I (2764297) wifi: pm stop, total sleep time: 2234832424 us / 2396858473 us

I (2764297) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
E (2766637) aws_iot: failed! mbedtls_ssl_write returned -0x4e
E (2766647) aws_iot: failed! mbedtls_ssl_write returned -0x4e
W (2766647) AIOT: MQTT Disconnect
I (2766647) AIOT: Auto Reconnect is enabled, Reconnecting attempt will start now
I (2766847) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
I (2766847) wifi: state: init -> auth (b0)
I (2766847) wifi: state: auth -> assoc (0)
I (2766857) wifi: state: assoc -> run (10)
I (2766887) wifi: connected with AirLinksys24G, channel 10, bssid = 60:38:e0:99:9d:35
I (2766887) wifi: pm start, type: 1

I (2767867) event: sta ip: 192.168.1.135, mask: 255.255.255.0, gw: 192.168.1.1
E (2862327) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
E (2952507) aws_iot: failed! mbedtls_ssl_setup returned -0x7f00
E (3048037) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
E (3143577) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
E (3238777) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800

ESP_Mahavir
Posts: 188
Joined: Wed Jan 24, 2018 6:51 am

Re: Amazon IOT disconnects and won't reconnect

Postby ESP_Mahavir » Fri Dec 14, 2018 9:11 am

Could you please help to check if there is sufficient dynamic memory available before attempting to connect to AWS IoT (error code -0x7F00 points to failure in allocation)? If not already done then,

Code: Select all

aws_iot_mqtt_disconnect()
API can help to free up memory from previous TLS connection, once there is WiFi disconnect event.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Amazon IOT disconnects and won't reconnect

Postby Ritesh » Sun Dec 16, 2018 5:02 pm

jrounds wrote:
Thu Dec 13, 2018 6:14 pm
I can send and receive messages from cloud until it drops then it won't reconnect. Some times it will stay connected for hours


I (2761787) wifi: bcn_timout,ap_probe_send_start
I (2764297) wifi: ap_probe_send over, resett wifi status to disassoc
I (2764297) wifi: state: run -> init (100)
I (2764297) wifi: pm stop, total sleep time: 2234832424 us / 2396858473 us

I (2764297) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
E (2766637) aws_iot: failed! mbedtls_ssl_write returned -0x4e
E (2766647) aws_iot: failed! mbedtls_ssl_write returned -0x4e
W (2766647) AIOT: MQTT Disconnect
I (2766647) AIOT: Auto Reconnect is enabled, Reconnecting attempt will start now
I (2766847) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
I (2766847) wifi: state: init -> auth (b0)
I (2766847) wifi: state: auth -> assoc (0)
I (2766857) wifi: state: assoc -> run (10)
I (2766887) wifi: connected with AirLinksys24G, channel 10, bssid = 60:38:e0:99:9d:35
I (2766887) wifi: pm start, type: 1

I (2767867) event: sta ip: 192.168.1.135, mask: 255.255.255.0, gw: 192.168.1.1
E (2862327) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
E (2952507) aws_iot: failed! mbedtls_ssl_setup returned -0x7f00
E (3048037) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
E (3143577) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
E (3238777) aws_iot: failed! mbedtls_ssl_handshake returned -0x6800
Hi,

Would you please check free heap size using getfreeheapsize API ? As it looks like there is an issue with memory as you are using mbedTLS and AWS IOT components which are heavy memory consumption. So just have doubt for that.
Regards,
Ritesh Prajapati

jrounds
Posts: 15
Joined: Thu Dec 13, 2018 6:11 pm

Re: Amazon IOT disconnects and won't reconnect

Postby jrounds » Thu Feb 28, 2019 6:51 pm

I call aws_iot_mqtt_disconnect and have even tried deleting the whole task thread and restarting it any suggestions?

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Amazon IOT disconnects and won't reconnect

Postby Ritesh » Fri Mar 01, 2019 4:18 am

jrounds wrote:
Thu Feb 28, 2019 6:51 pm
I call aws_iot_mqtt_disconnect and have even tried deleting the whole task thread and restarting it any suggestions?
Hi,

Did you try with checking free heap size remaining before calling any cloud based request? so that it will be easier for me to provide further suggestions.
Regards,
Ritesh Prajapati

jrounds
Posts: 15
Joined: Thu Dec 13, 2018 6:11 pm

Re: Amazon IOT disconnects and won't reconnect

Postby jrounds » Fri Mar 01, 2019 4:56 pm

See below the heap looks like it has plenty of mermory
Free 8bit-capable memory (after 32-bit): 22620K, 32-bit capable memory 83272K

I (318518) wifi: bcn_timout,ap_probe_send_start
W (318518) wifi: alloc eb len=76 type=2 fail, heap:20

W (318518) wifi: m f probe req l=0

W (319528) wifi: alloc eb len=76 type=2 fail, heap:20

W (319528) wifi: m f probe req l=0

W (320528) wifi: alloc eb len=76 type=2 fail, heap:20

W (320528) wifi: m f probe req l=0

I (321028) wifi: ap_probe_send over, resett wifi status to disassoc
I (321028) wifi: state: run -> init (c800)
I (321028) wifi: pm stop, total sleep time: 253083337 us / 316085321 us

I (321028) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
I (321038) AirCylcer: Event called
I (321158) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
I (321158) wifi: state: init -> auth (b0)
I (321168) wifi: state: auth -> assoc (0)
I (321168) wifi: state: assoc -> run (10)
I (321208) wifi: connected with AirLinksys24G, channel 10, bssid = 60:38:e0:99:9d:35
I (321208) wifi: pm start, type: 1

I (321208) AirCylcer: Event called
I (321798) event: sta ip: 192.168.1.149, mask: 255.255.255.0, gw: 192.168.1.1
I (321798) AirCylcer: Event called
E (331048) aws_iot: failed! mbedtls_ssl_write returned -0x4e
E (331518) aws_iot: failed! mbedtls_ssl_handshake returned -0x2700
E (331518) aws_iot: Unable to verify the server's certificate.
Free 8bit-capable memory (after 32-bit): 22620K, 32-bit capable memory 83272K
E (331528) AIOT: Error(-4) connecting to a1olbtf05i1ac0.iot.us-east-1.amazonaws.com:8883
E (341988) aws_iot: failed! mbedtls_ssl_handshake returned -0x2700
E (341988) aws_iot: Unable to verify the server's certificate.
Free 8bit-capable memory (after 32-bit): 22332K, 32-bit capable memory 82984K
E (341998) AIOT: Error(-4) connecting to a1olbtf05i1ac0.iot.us-east-1.amazonaws.com:8883
E (352258) aws_iot: failed! mbedtls_ssl_handshake returned -0x2700
E (352258) aws_iot: Unable to verify the server's certificate.
Free 8bit-capable memory (after 32-bit): 21692K, 32-bit capable memory 82344K
E (352268) AIOT: Error(-4) connecting to a1olbtf05i1ac0.iot.us-east-1.amazonaws.com:8883

jrounds
Posts: 15
Joined: Thu Dec 13, 2018 6:11 pm

Re: Amazon IOT disconnects and won't reconnect

Postby jrounds » Thu Mar 07, 2019 8:29 pm

Any suggestions I have been spinning my wheels on this issues. I understand that is is a heap size issues my guess is some wifi buffer fills up doesn't get cleared. Am I the only having issues any help would be greatly appreciated this is the last hurdle I am having with my code. Thank you
Joseph

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Amazon IOT disconnects and won't reconnect

Postby Ritesh » Fri Mar 08, 2019 5:18 pm

jrounds wrote:
Thu Mar 07, 2019 8:29 pm
Any suggestions I have been spinning my wheels on this issues. I understand that is is a heap size issues my guess is some wifi buffer fills up doesn't get cleared. Am I the only having issues any help would be greatly appreciated this is the last hurdle I am having with my code. Thank you
Joseph
Sorry. Let me check it in details tomorrow and get back to you.

Espressif Developer, would you guys please check it into parallel?
Regards,
Ritesh Prajapati

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Amazon IOT disconnects and won't reconnect

Postby fly135 » Fri Mar 08, 2019 7:58 pm

#define MBEDTLS_ERR_NET_SEND_FAILED -0x004E /**< Sending information through the socket failed. */
#define MBEDTLS_ERR_SSL_TIMEOUT -0x6800 /**< The operation timed out. */

Looks like you aren't waiting for the wifi to connect before trying to talk to the outside world.
E (2766637) aws_iot: failed! mbedtls_ssl_write returned -0x4e
E (2766647) aws_iot: failed! mbedtls_ssl_write returned -0x4e
W (2766647) AIOT: MQTT Disconnect
I (2766647) AIOT: Auto Reconnect is enabled, Reconnecting attempt will start now
I (2766847) wifi: new:<10,0>, old:<10,0>, ap:<255,255>, sta:<10,0>, prof:1
I (2766847) wifi: state: init -> auth (b0)
I (2766847) wifi: state: auth -> assoc (0)
I (2766857) wifi: state: assoc -> run (10)
I (2766887) wifi: connected with AirLinksys24G, channel 10, bssid = 60:38:e0:99:9d:35
I (2766887) wifi: pm start, type: 1

I (2767867) event: sta ip: 192.168.1.135, mask: 255.255.255.0, gw: 192.168.1.1
John A

jrounds
Posts: 15
Joined: Thu Dec 13, 2018 6:11 pm

Re: Amazon IOT disconnects and won't reconnect

Postby jrounds » Fri Mar 08, 2019 9:38 pm

Even with a wait it still the same message sorry the example I posted must of left that code out but the result is the same with our without it

Who is online

Users browsing this forum: awegel, Bing [Bot] and 120 guests