chirpstack-network-server icon indicating copy to clipboard operation
chirpstack-network-server copied to clipboard

Shutdown hangs if mqtt server already shutdown

Open PhilDay-CT opened this issue 3 years ago • 0 comments

  • [ X] The issue is present in the latest release.
  • [X ] I have searched the issues of this repository and believe that this is not a duplicate.

What happened?

During shutdown, if the mqtt server shuts down first the the network server hangs in its shutdown. That it turn means that postgres can't do a clean shutdown as the network server still has an open connection, and forcing a postgres shutdown can lead to corruption.

What did you expect?

Since the Network server has logged the mqtt connection error it should skip the unsubscribe and shutdown cleanly

Steps to reproduce this issue

Steps:

  1. On a running system
  2. stop mqtt
  3. stop network server

Could you share your log output?

2022-02-09T12:58:26.901423+00:00 2ad7594528e4 /supervisord: mosquitto 1644411506: mosquitto version 1.6.12 terminating
2022-02-09T12:58:26.901690+00:00 2ad7594528e4 /supervisord: chirpstack-network-server time="2022-02-09T12:58:26.901415463Z" level=error msg="gateway/mqtt: mqtt connection error: EOF"


2022-02-09T12:58:41.521347+00:00 2ad7594528e4 /supervisord: chirpstack-network-server time="2022-02-09T12:58:41.520241392Z" level=info msg="signal received" signal=terminated
2022-02-09T12:58:41.521424+00:00 2ad7594528e4 /supervisord: chirpstack-network-server time="2022-02-09T12:58:41.520350935Z" level=warning msg="stopping chirpstack-network-server"
2022-02-09T12:58:41.521455+00:00 2ad7594528e4 /supervisord: chirpstack-network-server time="2022-02-09T12:58:41.520392122Z" level=info msg="gateway/mqtt: closing backend"
2022-02-09T12:58:41.521486+00:00 2ad7594528e4 /supervisord: chirpstack-network-server time="2022-02-09T12:58:41.520410623Z" level=info msg="gateway/mqtt: unsubscribing from event topic" topic=gateway/+/event/+


Your Environment

Component Version
Application Server 3.16.10
Network Server 3.14.0
Gateway Bridge 3.12.0

PhilDay-CT avatar Feb 09 '22 13:02 PhilDay-CT