snabbco / snabb

Snabb: Simple and fast packet networking
Apache License 2.0
2.98k stars 301 forks source link

Implement shutdown command for the config program #1517

Closed alexandergall closed 1 year ago

alexandergall commented 1 year ago

The ptree framework is lacking a standard method for a clean shutdown for applications that are run without a finite duration. This PR implements the shutdown RPC which causes the loop in lib.ptree.ptree.Manager.main to terminate and call the stop() method of the manager just as for the case of a finite duration of the app engine.

The stop() method implies that all running fibers are cancelled, which causes a flurry of messages

 Error while running fiber: lib/ptree/inotify.lua:57: shutdown

to be logged. This is mainly a cosmetic issue but it clobbers the log and may confuse the user to believe there was a problem when there wasn't. The PR suppresses the printing of fiber-related messages if they contain the word "shutdown". A cleaner method to accomplish this could be desirable (i.e. terminate the fiber coroutine without throwing an error in case of a shutdown).