Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read and how they find the site, so we can improve it (Google Analytics).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Edge randomly disconnects

If an Edge instance repeatedly disconnects and reconnects to the server within a few seconds without an obvious cause, the most likely explanation is unstable network connectivity — low bandwidth, intermittent packet loss, or a NAT/load balancer dropping idle connections. The gRPC keepalive parameters control how the connection is probed and how long both sides wait before declaring it dead.

Before tuning keepalive parameters, verify the network is actually the cause:

  • Check Edge logs for connection errors: cat /var/log/tb-edge/tb-edge.log | grep ERROR
  • Test round-trip latency to the server: ping server_hostname
  • Check for packet loss: mtr server_hostname

If the network is stable and disconnections persist, consider other causes such as resource exhaustion on the Edge device.

Keepalive is configured independently on both sides. Both must be adjusted together — mismatched values will cause the server to terminate connections that the client considers healthy.

Server parameters (/etc/thingsboard/conf/thingsboard.conf)

Section titled “Server parameters (/etc/thingsboard/conf/thingsboard.conf)”
Parameter Default Description
EDGES_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC 1 s Minimum allowed interval between client keepalive pings. If a client pings more frequently than this, the server can terminate the connection.
EDGES_RPC_KEEP_ALIVE_TIME_SEC 10 s Time of inactivity after which the server sends a keepalive ping to the client.
EDGES_RPC_KEEP_ALIVE_TIMEOUT_SEC 5 s Maximum time the server waits for a response to its keepalive ping before closing the connection.

Edge parameters (/etc/tb-edge/conf/tb-edge.conf)

Section titled “Edge parameters (/etc/tb-edge/conf/tb-edge.conf)”
Parameter Default Description
CLOUD_RPC_KEEP_ALIVE_TIME_SEC 10 s Time of inactivity after which the Edge sends a keepalive ping to the server. Keeps the connection alive through NATs and load balancers that drop idle flows.
CLOUD_RPC_KEEP_ALIVE_TIMEOUT_SEC 5 s Maximum time the Edge waits for a response to its keepalive ping before considering the connection dead and attempting to reconnect.

On the ThingsBoard server, edit /etc/thingsboard/conf/thingsboard.conf and add:

Terminal window
export EDGES_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC=1
export EDGES_RPC_KEEP_ALIVE_TIME_SEC=30
export EDGES_RPC_KEEP_ALIVE_TIMEOUT_SEC=25

On the Edge device, edit /etc/tb-edge/conf/tb-edge.conf and add:

Terminal window
export CLOUD_RPC_KEEP_ALIVE_TIME_SEC=30
export CLOUD_RPC_KEEP_ALIVE_TIMEOUT_SEC=25

Restart both services to apply the changes:

Terminal window
sudo systemctl restart thingsboard
sudo systemctl restart tb-edge