After a lot of refactoring, I think I have some very stabile code now, but I still need to test the reconnect logic etc. What is the best approach to do this? Can I force the modem to randomly cut out somehow? And subsequently, what’s the best way to keep logs of what’s going on for troubleshooting? I’m guessing the 4MB flash will very quickly be filled up?
Best way to test/mock connection issues?
- Edited
but I still need to test the reconnect logic etc.
In my experience the nasty points are “partial network outages”, which can’t be tested. Some of such errors tends to be not detected by the modem and therefore are not reported as socket-error.
Some SIM-card provider offer a Web UI to reset the connection for a specific SIM card. That enables to test a lost PDN.
You may also use a separate server in order to stop that. Than enables to test application-connection issues.
A steal-cooking pot may also work. If it’s thick enough, that cuts the RF connection.
And tests in the “wild” are also usually required. I guess, in the past 12 months, I had several “good versions” but the wild demonstrated the opposite ;-).
Thanks AchimKraus!
I have several steel cooking pots, so gonna give that a go!
For anyone who lands here, these are the ideas that I have collected, some tried, others planned:
- Terminating the session on my MQTT server abruptly,
- Randomly throwing up a firewall that blocks the port on the server,
- Shutting down the server,
- Taking too long for the server to respond (e.g. adding delays)
- Killing sockets on the server
- Taking out the simcard during operation (not sure if this is safe, but it could happen in the wild if on shaking vehicles
- Returning too much data from the server, causing memory overflow, as well as incorrectly formatted data.
- Specifically for MQTT - Accepting the additional overhead of sending QoS 1 packages and actually checking if the server acknowledges receiving the package.
Happy to get feedback and additions to the list!
Though you use a TCP based protocol, do you use it with NB-IoT or LTE-M? If NB-IoT is used, you may also check, what happens, if the modem uses a “higher repetition” (see +CEINFO). That may be achieved using a “light steal pot” ;-). Enable the +CEINFO and check, what you get.