-
I am trying to call the login user api which complete successfully but at the final stage when it is cleaning and stoping the firebase it is crashing because of dangling pointer i suppose. I have added logs in the
this method is called from
below are the logs my application crashed at:
what i found is that this deleting sData log is coming only one time so this pointer is not getting deleted twice means its reference is Please let me know if this issue is valid or not. #Update I have tried commenting the
please verify if it is safe to comment the method i just did because in my case it is working without crash for about an hour. because this is just auth i integrated and i have to integrate firestore as well now in this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
There is no such issue in this library. The issue is about your code. When you pass something to function by reference or pointer, you have to keep it live within the usage scope. To identify the code faults, you should provide your code here. |
Beta Was this translation helpful? Give feedback.
-
The function you are mentioned is not for a public API access. If you are investigating from the traces before soft wdt crashed, it is the wrong point. You should use, Anyway, asking something about using the library that not provided by library's API was not support. The code below shows that all classes can be allocated locally and use locally. #define API_KEY ""
#define USER_EMAIL ""
#define USER_PASSWORD ""
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
#define ENABLE_USER_AUTH
#define ENABLE_DATABASE
#include <Arduino.h>
SET_LOOP_TASK_STACK_SIZE(16 * 1024);
#include <WiFi.h>
#include <FirebaseClient.h>
#include <WiFiClientSecure.h>
void setup()
{
Serial.begin(115200);
WiFi.begin(WIFI_SSID , WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
Firebase.printf("Firebase Client v%s\n", FIREBASE_CLIENT_VERSION);
WiFiClientSecure ssl_client;
using AsyncClient = AsyncClientClass;
AsyncClient aClient(ssl_client);
UserAuth user_auth(API_KEY, USER_EMAIL, USER_PASSWORD, 3000 /* expire period in seconds (<3600) */);
FirebaseApp app;
RealtimeDatabase Database;
auto auth_debug_print = [](AsyncResult &aResult)
{
if (aResult.isEvent())
{
Firebase.printf("Event task: %s, msg: %s, code: %d\n", aResult.uid().c_str(), aResult.eventLog().message().c_str(), aResult.eventLog().code());
}
if (aResult.isDebug())
{
Firebase.printf("Debug task: %s, msg: %s\n", aResult.uid().c_str(), aResult.debug().c_str());
}
if (aResult.isError())
{
Firebase.printf("Error task: %s, msg: %s, code: %d\n", aResult.uid().c_str(), aResult.error().message().c_str(), aResult.error().code());
}
};
auto show_status = [](bool status, AsyncClient &aClient)
{
if (status)
Serial.println("Success");
else
Firebase.printf("Error, msg: %s, code: %d\n", aClient.lastError().message().c_str(), aClient.lastError().code());
};
ssl_client.setInsecure();
Serial.println("Initializing app...");
initializeApp(aClient, app, getAuth(user_auth), 120 * 1000, auth_debug_print);
app.getApp<RealtimeDatabase>(Database);
Database.url(DATABASE_URL);
Serial.println("Setting the int value... ");
bool status = Database.set<int>(aClient, "/examples/Set/Await/int", 12345);
show_status(status, aClient);
Serial.println("Tasks in queue");
Serial.println(aClient.taskCount());
// Without calling app.loop() in the loop.
// To stop all tasks completely.
while (aClient.taskCount())
{
aClient.stopAsync(true);
}
ssl_client.stop();
Serial.println("Client has been stopped.");
}
void loop()
{
}
|
Beta Was this translation helpful? Give feedback.
FirebaseClient/examples/RealtimeDatabase/Get/Get.ino
Lines 75 to 76 in dbade5a