knolleary / pubsubclient

A client library for the Arduino Ethernet Shield that provides support for MQTT.
http://pubsubclient.knolleary.net/
MIT License
3.82k stars 1.47k forks source link

Memory leak on connection failed #938

Closed podaen closed 2 years ago

podaen commented 2 years ago

Arduino IDE (visual micro) ESP32-wrover

Hi,

I am new to this library and I having some memory issue when the connection is failed. it's not clear to me where the leak is coming from. I have updated the ssl_client library where memorie leak is detected in dec 2021, but still having a leak somewhere...

Ref: https://github.com/espressif/arduino-esp32/pull/5945/commits/bb218c395a970e1c404bddf3cc28140d79e1c274 Ref: https://github.com/espressif/arduino-esp32/commit/c282cd8f5fe1f856528f2c83d5117a6de8443028

try to send a msg to mqtt WiFi allready connected Attempting MQTT connection... Loading CA cert Setting hostname for TLS session... xPortGetFreeHeapSize: 13356

Performing the SSL/TLS handshake... [E][ssl_client.cpp:516] _handle_error(): [start_ssl_client():761]: (-9984) X509 - Certificate verification failed, e.g. CRL, CA or signature check failed [E][WiFiClientSecure.cpp:139] connect(): start_ssl_client: -9984 failed, rc=-2 try again in 2 seconds Attempting MQTT connection... Loading CA cert Setting hostname for TLS session... xPortGetFreeHeapSize: 12496

Performing the SSL/TLS handshake... [E][ssl_client.cpp:516] _handle_error(): [start_ssl_client():761]: (-9984) X509 - Certificate verification failed, e.g. CRL, CA or signature check failed [E][WiFiClientSecure.cpp:139] connect(): start_ssl_client: -9984 failed, rc=-2 try again in 2 seconds Attempting MQTT connection... [E][ssl_client.cpp:608] start_ssl_client(): socket error on fd 57, errno: 119, "Connection already in progress" [E][WiFiClientSecure.cpp:139] connect(): start_ssl_client: -1 failed, rc=-2 try again in 2 seconds Attempting MQTT connection... Loading CA cert Setting hostname for TLS session... xPortGetFreeHeapSize: 11968

Performing the SSL/TLS handshake... [E][ssl_client.cpp:516] _handle_error(): [start_ssl_client():761]: (-9984) X509 - Certificate verification failed, e.g. CRL, CA or signature check failed [E][WiFiClientSecure.cpp:139] connect(): start_ssl_client: -9984 failed, rc=-2 try again in 2 seconds Attempting MQTT connection... [E][ssl_client.cpp:608] start_ssl_client(): socket error on fd 59, errno: 119, "Connection already in progress" [E][WiFiClientSecure.cpp:139] connect(): start_ssl_client: -1 failed, rc=-2 try again in 2 seconds done try connect to mqqt (not connected)

podaen commented 2 years ago

Don't mind, after some time it goos back up.