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
|
from argparse import Namespace
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import errno
|
||||||
import logging
|
import logging
|
||||||
from multiprocessing import Event
|
from multiprocessing import Event
|
||||||
|
import subprocess
|
||||||
from typing import Set, Union, Dict, Any
|
from typing import Set, Union, Dict, Any
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
@ -145,7 +147,14 @@ class WsRouter:
|
||||||
|
|
||||||
# loop = tornado.ioloop.IOLoop.current()
|
# loop = tornado.ioloop.IOLoop.current()
|
||||||
logger.info(f"Listen on {self.config.ws_port}")
|
logger.info(f"Listen on {self.config.ws_port}")
|
||||||
self.application.listen(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()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
task = self.evt_loop.create_task(self.prediction_forwarder())
|
task = self.evt_loop.create_task(self.prediction_forwarder())
|
||||||
|
|
Loading…
Reference in a new issue