lorawan-stack icon indicating copy to clipboard operation
lorawan-stack copied to clipboard

Gracefully disconnect Gateways before shutting down Gateway Server

Open neoaggelos opened this issue 5 years ago • 1 comments

Summary

Gracefully disconnect Gateways before shutting down Gateway Server

Why do we need this?

Properly clear any cached connection stats of connected gateways when the Gateway Server is updated or restarted. It is also good to avoid leaving hung connections.

What is already there? What do you see now?

The GS shuts down without taking any care of existing gateway connections

What is missing? What do you want to see?

GS to properly close existing Gateway Connections before exiting.

Environment

3.8.5

How do you propose to implement this?

Catch exit signal on the GS, do some cleanup. We need to see how that affects shutdown times for a large number of gateways (~ 10K). It might be better to simply clear the connection stats in the cache registry instead.

How do you propose to test this?

Test locally, adding unit tests should also not be too hard.

Can you do this yourself and submit a Pull Request?

yes. Adding to Next Up, but this is useful for upgrades, so increase priority if needed.

neoaggelos avatar Jul 14 '20 15:07 neoaggelos

I much prefer going with clearing the connection stats for connected gateways for this one. Waiting for thousand of gateways to disconnect could become slow and error-prone (also, what if a gateway re-connects during that time?).

neoaggelos avatar Jul 21 '20 17:07 neoaggelos