Revision 2024-10-27T20:40:15Z
- Q1: Why I get an error
"TCP connection failed"
? - Q2: Why I get an error
"TCP send failed"
? - Q3: Why I get an error
"TCP receive timed out"
? - Q4: Why I get an error
"TCP disconnected"
? - Q5: What should I do when I get the error
"error opening file"
? - Q6: What should I do when I get the error
"error reading file"
or"error writng file"
? - Q7: What should I do when ESP32 crashed with the error
"Exception was unhandled"
? - Q8: What should I do when I get the error
"unauthenticate"
? - Q9: What should I do when I get the error
"JWT, private key parsing fail"
? - Q10: What should I do when I get the error
"JWT, token signing fail"
? - Q11: What should I do when I get the error
"too low sketch space"
? - Q12: What should I do when I get the error
"firmware write failed"
or"firmware end failed"
? - Q13: What should I do when I get the error
"stream connection timed out"
? - Q14: What should I do when I get the error
"auth revoked"
? - Q15: Why I get the error
"app was not assigned"
? - Q16: Why I get the error
"operation was cancelled"
? - Q17: Why I get the error
"JWT, time was not set or not valid"
? - Q18: Why sometimes the Realtime Database Stream does not work when WiFi was disconnected and reconnected and I get the error
"stream connection timed out"
? - Q19: Can I use delay in this library?
- Q20: Can I change the send timeout?
- Q21: Can I change the read timeout?
- Q22: Why my device crashed?
- Q23: How I restart the Realtime Database stream?
- Q24: How can I stop all tasks?
- Q25: How can I stop authentication task?
- Q26: How can I run more than one Realtime Database Stream with the same async client?
- Q27: How can I run Realtime Database task and Cloud Firestore Database task using the same async client?
- Q28: Why my Arduino MKR board failed to connect to the server?
- Q29: Why my SIM7600 failed to connect to the server?
- Q30: How to stop the authentication task?
- Q31: How to remove authentication task handler from Firebase service app?
It should be noted that the user defined SSL client that assigned with async client was used for server connection, sending and receiving the data to/from server.
Library also provides the option to resume the network connection in case of network connection disconnected.
In case WiFi, if the Core SDK provides reconnection function, library will reconnect to WiFi using that function otherwise the WiFi AP credentials are required.
In case Ethernet, if external Ethernet client was used, library will provided the configuarations to allow Ethernet module enabling/resetting and initialization.
In case GSM, it requires the configurations for initialize the TinyGSM modem.
In case generic client, it required the callback function to handle the network connection/reconnection.
Then there are many possible causes of connection issue that cause the SSL client fail to connect to server.
-
If you are using ESP32 device, and the reconnect option in
DefaultNetwork
was enabled. The bugs in outdated ESP32 Core WiFi will cause the unknown network connection issue when library is trying to reconnect your WiFi usingWiFi.reconnect()
. You have to update the ESP32 Arduino Core SDK to latest version or at least v2.x.x. -
When the WiFi was managed for connection and reconnection by user code or third party library e.g. WiFiManager, you have to set the reconnect option in
DefaultNetwork
to false otherwise you are unable to re-connect to the WiFi due to interferences operations. -
The voltage drops or noisy power supply cable can cause the server connection failure even WiFi was connected. Replace the power cable or usb cable with shorter length. Connect the large capacitor to your board Vcc and GND or use robust power supply.
-
The poor WiFi signal and WiFi channels interference. In fist case you have to move your device close to the WiFi hotspot or extend the range of your WiFi. The later case, you can change the WiFi channel of your WiFi hotspot.
-
WiFi AP was not responding because of static IP. You can connect your device to WiFi AP using DHCP instead.
-
In ESP32, ADC channel 2 cannot be used while using WiFi.
-
ESP8266/ESP32 ESP-Now conflicts. You can't use WiFi while using ESP-Now.
-
ESP32 Bluetooth conflicts. You can't use WiFi while using its Bluetooth.
-
If you are using
Arduino UNO R4 WiFi
,Arduino Portenta C33
,Arduino MKR WiFi 1010
,Arduino NANO 33 IoT
, andArduino Nano RP2040
, please make sure you have already done the following.- Add the
Realtime Database host root certificate
to the board firmware. Plese see Upload SSL root certificates for how to. - Install the WiFiNINA library.
- Add the
-
If you are using
Arduino® MKR 1000 WIFI
, please make sure you have already done the following.- Add the
Realtime Database host root certificate
to the board firmware. - Install the WiFi101 library and uninstall or remove the WiFiNINA library from the libraries folder if it was installed.
- Add the
-
The cable problem. Check your Ethernet cable.
-
Ethernet module failure. Change your Ethernet module.
-
The router was not responding because of static IP. You can connect your device to your router using DHCP instead.
-
The Ethernet library issue. The buffer allocated in Ethernet library is too snall and cause the SSL Client fail to decrypt the incomplete SSL data. You should increase the buffer size or reduce the number of socket connections.
-
Incorrect TinyGSMClient library configuration. The GSM module macros e.g.
TINY_GSM_MODEM_SIM7600
should be defined in two locations.- In src/Config.h or in your own defined config at src/UserConfig.h or adding
TINY_GSM_MODEM_SIM7600
in compiler build flags. - In your sketch.
- In src/Config.h or in your own defined config at src/UserConfig.h or adding
-
GSM library issue. Follow the GSM library examples. Post your issue in the GSM library repository.
-
GSM module failure, SIM failure and the mobile network problems. Change your GSM module, SIM and contact Mobile network operator.
- Memory allocation failure due to out of memory. The SSL client may fail to allocate memory required during SSL/TLS handshake. You have to reduce the memory used by your code and inspect memory usage for memory leaks.
A2: The time that used while sending the request (header or payload) is greater than the send timeout.
-
The delay function and user blocking code are used in the same loop that async task handler is running and they blocked the async task handler to work. You have to remove the delay function from loop function or minimize the time that used by your blocking code.
-
The poor WiFi signal, voltage drops, noisy power supply and the network problems. See Q1: Why I get an error
"TCP connection failed"
?. -
Poor internet condition. Many devices connected on the same network may shere the internet connection. Change the router, AP or network.
-
In case of upload, the file read operation may take longer time because some harware problemsor memory issue in filesystems. Change your media card its adapter and wirings between your device and SD/MMC module or adapter. If you are working with SD and you are not using ESP8266, please try the SdFat library instead.
-
The send timeout is too small. In case sync task, the send timeout can be set via
AsyncClientClass::setSyncSendTimeout
. The async task send timeout is 30 seconds and cannot be changed and you have to fix the possible issues instead of increasing the send timeout.
A3: The time that used while processing the server response (header or payload) is greater than the read timeout.
-
The delay function and user blocking codes are used in the same loop that async task handler is running and they blocked the async task handler to work. You have to remove the delay function from loop function or minimize the time that used by your blocking code.
-
The poor WiFi signal, voltage drops, noisy power supply and the network problems. See Q1: Why I get an error
"TCP connection failed"
?. -
Poor internet condition. Many devices connected on the same network may shere the internet connection. Change the router, AP or network.
-
In case of download, the file write operation may take longer time because some harware problems or memory issue in filesystems. Change your media card its adapter and wirings between your device and SD/MMC module or adapter. If you are working with SD and you are not using ESP8266, please try the SdFat library instead.
-
The read timeout is too small. In case sync task, the read timeout can be set via
AsyncClientClass::setSyncReadTimeout
. The async task read timeout is 30 seconds and cannot be changed and you have to fix the above issues instead of increasing the timeout.
Read Q1: Why I get an error "TCP connection failed"
?.
-
File does not exist for reading. Check for the file existent when open the file for reading.
-
The filesytem is not mounted. Mount your filesystem and try to reformat your filesystems.
-
The SD card and its adapter failure or wirings between your device and card problems. Change your SD card, adapter and check the wirings.
-
Memory allocation failure due to out of memory. The filesystem may not work in this case and you have to solve the memory issue. You have to reduce the memory used by your code and inspect memory usage for memory leaks.
If filesytem was mounted successfully.
-
The SD card and its adapter failure or wirings between your device and card problems. Change your SD card, adapter and check the wirings.
-
Memory allocation failure due to out of memory. The filesystem may not work in this case and you have to solve the memory issue. You have to reduce the memory used by your code and inspect memory usage for memory leaks.
13:07:18.043 -> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
13:07:18.043 ->
13:07:18.043 -> Core 1 register dump:
13:07:18.043 -> PC : 0x400ed967 PS : 0x00060d30 A0 : 0x800eda90 A1 : 0x3ffdc7f0
13:07:18.043 -> A2 : 0x3ffdc854 A3 : 0x00000000 A4 : 0x3ffdc8c4 A5 : 0x3ffdc8cc
13:07:18.075 -> A6 : 0x3ffdc8dc A7 : 0x00000000 A8 : 0x00000000 A9 : 0xcccccccd
13:07:18.075 -> A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x0000ff00
13:07:18.075 -> A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000020 EXCCAUSE: 0x0000001c
13:07:18.075 -> EXCVADDR: 0x00000002 LBEG : 0x4008b215 LEND : 0x4008b225 LCOUNT : 0xffffffff
The dangling pointer issue occurred when you are trying to use the object that point by the pointer that was deconstructed or not existed.
The memory allocation failure due to out of memory can cause the dangling pointer as the pointer is still point to the unallocated memory.
You have to wait for the authentication task to be ready before calling the Firebase functions.
After App Initialization, you can wait (blocking operation) or checking the return value of FirebaseApp::ready
in the loop.
The private key can be obtained from the service account credentials. Please read Service Account for more details.
This can be the out of memory issue. You have to reduce the memory usage and check for memory leaks.
Please check the partition size.
A12: The OTA download process is unterruped and cause the data wrtting failure or the library unknown error.
In case download process interrupted, see Q1: Why I get an error "TCP connection failed"
?.
In case unkbown error, please verify your free flash and do not write any file to the filesytem that decreased the free flash space.
To check whether Stream is timed out or not, use AsyncResult::to<RealtimeDatabaseResult>()::eventTimeout()
.
For the reasons, please read Possible WiFi issues.
The delay function and user blocking code are used in the same loop that authentication task handler is running and they blocked the authentication task handler to work. You have to remove the delay function from loop function or minimize the time that used by your blocking code.
You have to apply the FirebaseApp by using FirebaseApp::getApp
. Please read App Initialization for more details.
A16: The async client's queue is full due to too many new tasks are added while the old tasks that waiting in the queue are not yet processed.
The currently running task in the queue may be slow because of the delay function and user blocking codes are used in the same loop that async task handler is running and they blocked the async task handler to work. You have to remove the delay function from loop function or minimize the time that used by your blocking code.
Some network problem can be the cause, see Q1: Why I get an error "TCP connection failed"
?.
When more than one SSE mode (HTTP Streaming)
task was add to the queue. You cannot run more than one stream per async client. Please see Q26: How can I run more than one Realtime Database Stream with the same async client?.
When no more memory to be allocated for new task. You have to reduce the memory usage.
The timestamp that you set in the uint32_t variable of time status callback function is not valid or it was not set.
Q18: Why sometimes the Realtime Database Stream does not work when WiFi was disconnected and reconnected and I get the error "stream connection timed out"
?
Please read Possible WiFi issues.
If the delay was used in the loop it causes many errors e.g. read and send timed out and stream connection timed out.
The sync task send timeout can be set via AsyncClientClass::setSyncSendTimeout
. The async task send timeout is 30 seconds and cannot be changed.
The sync task read timeout can be set via AsyncClientClass::setSyncReadTimeout
. The async task read timeout is 30 seconds and cannot be changed.
-
Out of memory. Reduce memory usage and check memory usage for memory leaks.
-
Stack over flow. When you define class objects, variables and calling the function inside the callback function, they use stack memory
Then you should avoid the stack overflow problem by moving all codes in the callback to run in the main loop function instead.
- The dangling pointer issue.
It is because you are trying to use the object that point by the pointer that was destroyed or not existed.
The memory allocation failure due to out of memory can cause the dangling pointer as the pointer is still point to unallocated memory.
If network disconnected and re-connected, network connected but internet access was missing, and no events included keep-alive event received within 40 seconds, the Stream will be closed and restarted automatically as long as the async client's queue was running.
The stream connection timed out
error will show in case timed out (no events received within 40 seconds).
If you are intend to totally remove the steam task from the queue, and stream is running, use AsyncClientClass::stopAsync()
. If you are not sure that stream was running or stopped because of other tasks, use AsyncClientClass::stopAsync(true)
to cancell all tasks and remove all tasks from the queue.
The AsyncClientClass::stopAsync()
will stop only the running task and remove from queue while AsyncClientClass::stopAsync(true)
will stop the running task and remove all tasks in the queue.
You have to remove the functions; FirebaseApp::loop()
and/or FirebaseServicesApps::loop()
(if the same async client was used in FirebaseServicesApps
and FirebaseApp
) from the loop
.
The SSE mode (HTTP Streaming)
task is a kind of infinite task
which the server connection was kept alive and waiting for the incoming event data.
You cannot run more than one infinite task
in the same async client's queue as one infinite task
is never finished, and another infinite task
is never started.
To run many SSE mode (HTTP Streaming)
tasks, you have to run each task in different async client. Please note that SSE mode (HTTP Streaming)
task consumes memory all the time while it is running. Running many SSE mode (HTTP Streaming)
tasks may not possible because of out of memory.
For running more tasks concurrency, see Running Many Tasks Concurrency Using Different Async Clients (In Different SSL Clients).
Q27: How can I run Realtime Database task and Cloud Firestore Database task using the same async client?
A27: Yes, you can run different Firebase Products using the same async client or different async client.
When you run different Firebase products using the same async client, all tasks are in the same queue and it needs to start the new server connection for different host of Firebase products. This takes time when establish the new server connection.
When you run different Firebase products using the different async clients, all tasks are in the different queues. When tasks are running concurrency, it consumed more memory which may not suitable for low memory devices.
For running more tasks concurrency, see Running Many Tasks Concurrency Using Different Async Clients (In Different SSL Clients).
A28: Please see, Possible WiFi issues and Possible WiFi firmware issues.
A29: Please see, Possible GSM issues.
A30: Normally the authentication task was unable to stop after initialized unless it can deinitialize.
You can use deinitializeApp(<FirebaseApp>)
to deinitalize the FirebaseApp
that was initialized.
You also can block the FirebaseApp::loop()
from the running in loop to pause the authentication task but it is not recommended.