I encountered an issue yesterday where the agent keeps timeout for my imp004 project. This issue persisted in the afternoon PST.
I’m wondering if others has experienced such instability before and what is the best practice to get agent online again. Thank you!
Inbound or outbound? You don’t mention that. Inbound timeouts are usually mishandling of the request object, eg wrongly queuing it for an async reply in your squirrel code.
If restarting the agent causes an error to be immediately returned to the requestor, then that’s a symptom of this.
If it’s outbound, what’s the error code you are seeing?
Thank you for your reply Hugo.
Since this only happened one day, I can only speak from my memory at this point.
It was inbound request timing out.
Request was sent from an app to Agent, and requests were timing out with error code 403, which after checking the Agent code, I realized the Agent will respond 403 if device is offline.
The part only confusing or I’m unsure about is why device will inconsistently getting offline, besides suspecting the wifi network wasn’t stable that day.
What would be some common cause of the device going offline when nothing was done to the device and it’s in it’s same location.
There are many things that can cause a device disconnection; wifi issues (interference, low signal, too much signal, etc - what’s the RSSI?), router issues (NAT timeouts especially common), ISP issues (lack of routing or DNS) etc.
There are blackbox records which support can pull to tell you what happened for a period a device was offline - the device collects this info and then sends it to the server on next connect for exactly these diagnostics.
You can also log this sort of thing with offline logging and log the server.connect return codes.
Hi Hugo, thanks for the information! Getting those blackbox record sounds great. Are you suggesting I can log those record through server.connect? Where can I find resource on how to use server.connect? So far I’ve only exposed to server.log and server.error functions. Not an expert on squirrel or IMP004. Thank you!
The documentation for
server.connect is here: server.connect() | Dev Center
The second example shows how status codes are returned via a squirrel callback function.
Blackbox records are not publicly accessible - if you DM a device id and the timestamp of a connection event we can extract them for you.
The actual black box records (that contain details like time to associate, DHCP retries, DNS failures, etc) are only available to support staff. Commercial customers can get access to these by filing a support ticket.
However, if you use the connection manager library (recommended!) this also provides log() and error() functions which will work like server.log and server.error when online, but if the device is offline these will instead queue the messages and then replay them when the device does connect - it’s a really easy place to log server.connect response codes, for example.
I will check out the connection manager library. Thank you hugo!
Thank you Phil. I will note this and reach out if I notice the disconnection next time! Thank you!