Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kytos running in foreground takes forever to stop #492

Open
italovalcy opened this issue Aug 5, 2024 · 4 comments
Open

Kytos running in foreground takes forever to stop #492

italovalcy opened this issue Aug 5, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@italovalcy
Copy link

Hi,

While running newest version of Kytos (from amlight/kytos:latest docker container), with tmux, Kytos takes forever to stop (in fact, I waited a long time and then just gave up and issue a CTRL+C):

kytos $> (CTRL+D)
Stopping Kytos daemon... Bye, see you!
2024-08-05 13:26:39,305 - INFO [kytos.core.controller] (MainThread) Stopping Kytos controller...
2024-08-05 13:26:39,305 - INFO [kytos.core.controller] (MainThread) Stopping Kytos
...
2024-08-05 13:26:39,335 - INFO [kytos.core.api_server] (MainThread) The Rest endpoints from /api/kytos/of_core/ were disabled.
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(msg_in, min_hits=5, min_size=512, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(msg_out, min_hits=5, min_size=512, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(raw, min_hits=5, min_size=512, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(app, min_hits=5, min_size=1024, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(threadpool_sb, min_hits=5, min_size=256, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(threadpool_app, min_hits=5, min_size=512, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping QueueMonitor(threadpool_db, min_hits=5, min_size=256, delta_secs=5)...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping API Server...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopped API Server
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopping TCP Server...
2024-08-05 13:26:39,335 - INFO [kytos.core.controller] (MainThread) Stopped TCP Server
@italovalcy
Copy link
Author

Running without tmux results in the same behavior:

# kytosd -f --database MongoDB
Web update - Web UI was not updated
2024-08-05 13:30:42,805 - INFO [kytos.core.db] (MainThread) Starting DB connection
2024-08-05 13:30:42,806 - INFO [kytos.core.db] (MainThread) Trying to run 'hello' command on MongoDB...
2024-08-05 13:30:42,832 - INFO [kytos.core.db] (MainThread) Ran 'hello' command on MongoDB successfully. It's ready!
...
kytos $> (you type CTRL+D)
Stopping Kytos daemon... Bye, see you!
2024-08-05 13:31:00,578 - INFO [kytos.core.controller] (MainThread) Stopping Kytos controller...
2024-08-05 13:31:00,578 - INFO [kytos.core.controller] (MainThread) Stopping Kytos
...
2024-08-05 13:31:00,612 - INFO [kytos.core.controller] (MainThread) Stopping API Server...
2024-08-05 13:31:00,612 - INFO [kytos.core.controller] (MainThread) Stopped API Server
2024-08-05 13:31:00,612 - INFO [kytos.core.controller] (MainThread) Stopping TCP Server...
2024-08-05 13:31:00,612 - INFO [kytos.core.controller] (MainThread) Stopped TCP Server
^CException ignored in: <module 'threading' from '/usr/lib/python3.11/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1583, in _shutdown
    lock.acquire()
KeyboardInterrupt:
# date
Mon Aug  5 13:36:05 UTC 2024

Waited for 5min without success.

@Alopalao
Copy link

Alopalao commented Aug 29, 2024

Found 1 cause of a possible hanging from coloring. But it is not the case reported above.

@Alopalao
Copy link

Alopalao commented Sep 4, 2024

Reasons for a long shutdown:

  • A @retry was triggered just before a shutdown
  • time.sleep() was not finished. We could be using self.__event.wait() from the Event in base instead so we do not wait for slept threads to wake up.

These two do not hang, but with a large topology the shutdown could take up to a minute.

@viniarck viniarck added bug Something isn't working and removed priority_major Major priority 2024.1 Kytos-ng 2024.1 labels Sep 17, 2024
@viniarck
Copy link
Member

It's believed that with #501 this issue has been indirectly fixed too. Since it hasn't been exactly reproduced we'll leave this issue here open for some more time and if it doesn't manifest or get reproduced it'll get closed. I've removed the 2024.1 label due to this considered indirectly fixed for the moment. Thanks, guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants