MQTT Connection ssl_client error Help!

Hello

Currently, there is a device that periodically publishes MQTT by connecting ESP32 to AWS IoT Core.
This device keeps getting errors as shown in the picture below.
It's not a collective error, it's anomalous, and the frequency is different every time, so it's very difficult to guess the cause.
Is there anyone who knows anything about this error?






Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project. See About the Installation & Troubleshooting category.

What would "Payload : 21" indicate? Sounds like some kind of overload, to large blocks or blocks comming too close in time?

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Post a schematic.

Post an image of your project.

Which Micro Controller are you using?

Is this simulator code?

Please describe the problem better then you just did.

It appears the network connection keeps getting disconnected and that the code is trying to publish with disconnected WiFi.

here is an expanded WiFi callback that I've used to help troubleshoot WiFi disconnect issues.

void WiFiEvent(WiFiEvent_t event)
{
   log_i( "[WiFi-event] event: %d\n", event );
  switch (event) {
        case SYSTEM_EVENT_WIFI_READY:
          log_i("WiFi interface ready");
          break;
        case SYSTEM_EVENT_SCAN_DONE:
          log_i("Completed scan for access points");
          break;
        case SYSTEM_EVENT_STA_START:
          log_i("WiFi client started");
          break;
        case SYSTEM_EVENT_STA_STOP:
          log_i("WiFi clients stopped");
          break;
    case SYSTEM_EVENT_STA_CONNECTED:
      log_i("Connected to access point");
      break;
    case SYSTEM_EVENT_STA_DISCONNECTED:
      log_i("Disconnected from WiFi access point");
      break;
        case SYSTEM_EVENT_STA_AUTHMODE_CHANGE:
          log_i("Authentication mode of access point has changed");
          break;
        case SYSTEM_EVENT_STA_GOT_IP:
          log_i ("Obtained IP address: %s",  WiFi.localIP() );
          break;
        case SYSTEM_EVENT_STA_LOST_IP:
          log_i("Lost IP address and IP address is reset to 0");
          //      vTaskDelay( 5000 );
          //      ESP.restart();
          break;
        case SYSTEM_EVENT_STA_WPS_ER_SUCCESS:
          log_i("WiFi Protected Setup (WPS): succeeded in enrollee mode");
          break;
        case SYSTEM_EVENT_STA_WPS_ER_FAILED:
          log_i("WiFi Protected Setup (WPS): failed in enrollee mode");
          //      ESP.restart();
          break;
        case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT:
          log_i("WiFi Protected Setup (WPS): timeout in enrollee mode");
          break;
        case SYSTEM_EVENT_STA_WPS_ER_PIN:
          log_i("WiFi Protected Setup (WPS): pin code in enrollee mode");
          break;
        case SYSTEM_EVENT_AP_START:
          log_i("WiFi access point started");
          break;
        case SYSTEM_EVENT_AP_STOP:
          log_i("WiFi access point  stopped");
          //      WiFi.mode( WIFI_OFF);
          //      esp_sleep_enable_timer_wakeup( 1000000 * 2 ); // 1 second times how many seconds wanted
          //      esp_deep_sleep_start();
          break;
        case SYSTEM_EVENT_AP_STACONNECTED:
          log_i("Client connected");
          break;
    case SYSTEM_EVENT_AP_STADISCONNECTED:
      log_i("WiFi client disconnected");
          break;
        case SYSTEM_EVENT_AP_STAIPASSIGNED:
          log_i("Assigned IP address to client");
          break;
        case SYSTEM_EVENT_AP_PROBEREQRECVED:
          log_i("Received probe request");
          break;
        case SYSTEM_EVENT_GOT_IP6:
          log_i("IPv6 is preferred");
          break;
        case SYSTEM_EVENT_ETH_GOT_IP:
          log_i("Obtained IP address");
          break;
    default: break;
  }
}

you'll have to modify it to suit your things.

The AWS MQTT Service can deliver up to 128KB.
Usually, publishing works very well, but after such an issue happens once in a while, the reconnection action is taking place.

There is no problem with Wifi, and only MQTT is disconnected due to SSL error.

The subject is not exactly my home territory but You've got a another helper stepping in. Read and follow his advice.

Who is It??

Reply #5, @ Idahowalker

Thank you for your kind reply.
However, WiFi Disconnection is not occurring on my device right now.
It is assumed that there is no relationship.
Only MQTT is experiencing SSL Error & Disconnection.

Is there a possibility of conflict with using the multi-tasking function when using the current WiFi Client Secure Library?

If that's not the case, is there a possibility that the setBufferSize is set too small?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.