From 8a459a48213073776e98ccdb6e4330f1d1979c10 Mon Sep 17 00:00:00 2001 From: John Fleming <31658656+spikefishjohn@users.noreply.github.com> Date: Tue, 20 Feb 2024 00:46:00 -0500 Subject: [PATCH 1/2] Update notification_handler.py Force close websocket tcp socket. --- gns3server/handlers/api/controller/notification_handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gns3server/handlers/api/controller/notification_handler.py b/gns3server/handlers/api/controller/notification_handler.py index bf41ad20..9c532e44 100644 --- a/gns3server/handlers/api/controller/notification_handler.py +++ b/gns3server/handlers/api/controller/notification_handler.py @@ -82,6 +82,11 @@ class NotificationHandler: log.info("Client has disconnected from controller WebSocket") if not ws.closed: await ws.close() + try: + # call close to force close ws transport. Unknown root cause as of yet. + ws._req.transport.close() + except: + pass request.app['websockets'].discard(ws) return ws From 8d7e7f8aea57cb382d45a77325812d2eeed6a5ba Mon Sep 17 00:00:00 2001 From: John Fleming <31658656+spikefishjohn@users.noreply.github.com> Date: Tue, 20 Feb 2024 00:55:57 -0500 Subject: [PATCH 2/2] Update notification_handler.py Add fixme note. --- gns3server/handlers/api/controller/notification_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gns3server/handlers/api/controller/notification_handler.py b/gns3server/handlers/api/controller/notification_handler.py index 9c532e44..832b6388 100644 --- a/gns3server/handlers/api/controller/notification_handler.py +++ b/gns3server/handlers/api/controller/notification_handler.py @@ -83,6 +83,7 @@ class NotificationHandler: if not ws.closed: await ws.close() try: + # FIXME - This shouldn't be needed. Maybe need bug opened with aiohttp? # call close to force close ws transport. Unknown root cause as of yet. ws._req.transport.close() except: