kytos-ng / kytos

Kytos SDN Platform. Kytos is designed to be easy to install, use, develop and share Network Apps (NApps).
https://kytos-ng.github.io/
MIT License
3 stars 7 forks source link

Sometimes `kytosd` in foreground when handling a `SystemExit` ends up requiring extra ctrl-c to completely exit #424

Closed viniarck closed 11 months ago

viniarck commented 11 months ago

Sometimes kytosd in foreground when handling a SystemExit ends up requiring extra ctrl-c to completely exit. For instance, here's a case where I was simulating an unhandled exception on mef_eline, but then it required hitting again extra ctrl-c to properly finish. It's a low priority issue, it doesn't impact much, but it can be a bit cumbersome when it happens:

2023-10-25 09:04:24,590 - INFO [kytos.core.controller] [controller.py:851:load_napps] (MainThread) Loading NApp kytos/mef_eline
2023-10-25 09:04:24,817 - INFO [apscheduler.scheduler] [base.py:171:start] (MainThread) Scheduler started
Kytos couldn't start because of KytosNAppSetupException: NApp kytos/mef_eline exception some err  Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 817, in load_napp
    napp = napp_module.Main(controller=self)
  File "/home/viniarck/repos/kytos/kytos/core/napps/base.py", line 194, in __init__
    self.setup()
  File "/home/viniarck/repos/napps/napps/kytos/mef_eline/main.py", line 66, in setup
    raise ValueError("some err")
ValueError: some err

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 264, in start
    self.start_controller()
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 362, in start_controller
    self.load_napps()
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 852, in load_napps
    self.load_napp(napp.username, napp.name)
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 820, in load_napp
    raise KytosNAppSetupException(msg) from exc
kytos.core.exceptions.KytosNAppSetupException: KytosNAppSetupException: NApp kytos/mef_eline exception some err 

2023-10-25 09:04:24,821 - ERROR [kytos.core.controller] [kytosd.py:156:async_main] (MainThread) Kytos couldn't start because of KytosNAppSetupException: NApp kytos/mef_eline exception so
me err  Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 817, in load_napp
    napp = napp_module.Main(controller=self)
  File "/home/viniarck/repos/kytos/kytos/core/napps/base.py", line 194, in __init__
    self.setup()
  File "/home/viniarck/repos/napps/napps/kytos/mef_eline/main.py", line 66, in setup
    raise ValueError("some err")
ValueError: some err

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 264, in start
    self.start_controller()
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 362, in start_controller
    self.load_napps()
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 852, in load_napps
    self.load_napp(napp.username, napp.name)
  File "/home/viniarck/repos/kytos/kytos/core/controller.py", line 820, in load_napp
    raise KytosNAppSetupException(msg) from exc
kytos.core.exceptions.KytosNAppSetupException: KytosNAppSetupException: NApp kytos/mef_eline exception some err 

Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<start_shell_async() running at /home/viniarck/repos/kytos/kytos/core/kytosd.py:120>>
2023-10-25 09:04:24,821 - INFO [kytos.core.controller] [kytosd.py:157:async_main] (MainThread) Shutting down Kytos...
/home/viniarck/repos/kytos/kytos/core/kytosd.py:98: RuntimeWarning: coroutine 'start_shell_async' was never awaited
  async_main(config)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

^CException ignored in: <module 'threading' from '/usr/lib/python3.9/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 1477, in _shutdown
    lock.acquire()
KeyboardInterrupt: