marvinroger / async-mqtt-client

📶 An Arduino for ESP8266 asynchronous MQTT client implementation
MIT License
848 stars 268 forks source link

AsyncMQTTClient::publish() is crashing the ESP32-CAM #280

Closed jollyto closed 2 years ago

jollyto commented 2 years ago

The AsyncMQTTClient::publish() is crashing the ESP32-CAM

Here is the code:

void takePublishPhoto(){
  Serial.println("-- ====================");
   Serial.println("-- Taking a photo ...");

   camera_fb_t* fb = NULL;
   fb = esp_camera_fb_get();

  Serial.println("-- Photo taken!");

  if (!fb)
  {
    Serial.println("Camera capture failed !!!");
    return;
  }

  Serial.print("-- Frame Size : ");Serial.println(fb->len);Serial.println();
  Serial.println("-- Publishing ...");

  String encoded = base64::encode(fb->buf, fb->len );
  Serial.print("-- Encoded Size : ");Serial.println(encoded.length());Serial.println();

  printRamUsage("Before publish photo");

  int result = mqttClient.publish( PUB_TOPIC_PHOTO, 0, false, 
                                 (const char*)encoded.c_str(), encoded.length()); // fb->len );  
  esp_camera_fb_return(fb);

  }

Here is the output :

09:31:16.137 -> -- ====================
09:31:16.137 -> -- Taking a photo ...
09:31:16.173 -> -- Photo taken!
09:31:16.173 -> -- Frame Size : 23944
09:31:16.209 -> 
09:31:16.209 -> -- Publishing ...
09:31:16.209 -> -- Encoded Size : 31928
09:31:16.209 -> 
09:31:16.209 -> 
09:31:16.209 -> -- RAM USAGE Before publish photo --
09:31:16.209 -> Total heap : 323968
09:31:16.209 -> Free heap  : 104964
09:31:16.209 -> PSRAM found: Yes
09:31:16.209 -> Total PSRAM: 4194252
09:31:16.209 -> Free PSRAM : 4194252
09:31:16.209 -> Used PSRAM : 0
09:31:16.209 -> Free Memory: 40864
09:31:16.209 -> 
09:31:16.209 -> abort() was called at PC 0x4014b1e7 on core 1

Any ideas what may crash when calling the publish() method.

bertmelis commented 2 years ago

Where is the image data storeed? In PSRAM? Do you happen to have a (decoded) stack trace?

jollyto commented 2 years ago

On Mar 3, 2022, at 10:25 AM, Bert Melis @.***> wrote:

Where is the image data storeed? In PSRAM?

Local RAM Do you happen to have a (decoded) stack trace?

Nope — Reply to this email directly, view it on GitHub https://github.com/marvinroger/async-mqtt-client/issues/280#issuecomment-1058153794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG2PEQOQ3PGWMXYLQ5MOU3U6DKWFANCNFSM5P2VFG3Q. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Jose Rivera email: @.*** phone: (407) 249-2218

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

luebbe commented 2 years ago

@jollyto since you put that much effort in your reply, you are surely expecting everyone here to grab their crystal balls and debug your code for you... /sarcasm off

luebbe commented 2 years ago

Funny thing is: people here are willing to help you. You just have to provide the information that allows us to help

jollyto commented 2 years ago

And I really appreciated. But I need to get prepared to provide more detail (stack trace, ect). That s why I closed the issue. As soon as I get organized I’ll reopen the issue.
My sincerely apologies if I offended the group with my short explanation of the problem.

— José

On Mar 4, 2022, at 9:30 AM, Lübbe Onken @.***> wrote:

 Funny thing is: people here are willing to help you. You just have to provide the information that allows us to help

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you modified the open/close state.