list which processes occupy port
This commit is contained in:
parent
44a618a5ee
commit
cd8a06a53b
1 changed files with 10 additions and 1 deletions
|
@ -1,8 +1,10 @@
|
|||
|
||||
from argparse import Namespace
|
||||
import asyncio
|
||||
import errno
|
||||
import logging
|
||||
from multiprocessing import Event
|
||||
import subprocess
|
||||
from typing import Set, Union, Dict, Any
|
||||
from typing_extensions import Self
|
||||
|
||||
|
@ -145,7 +147,14 @@ class WsRouter:
|
|||
|
||||
# loop = tornado.ioloop.IOLoop.current()
|
||||
logger.info(f"Listen on {self.config.ws_port}")
|
||||
try:
|
||||
self.application.listen(self.config.ws_port)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EADDRINUSE:
|
||||
logger.critical("Address already in use by process")
|
||||
subprocess.run(["lsof", "-i", f"tcp:{self.config.ws_port:d}"])
|
||||
raise
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
task = self.evt_loop.create_task(self.prediction_forwarder())
|
||||
|
|
Loading…
Reference in a new issue