【问题标题】:CannotListenError: Couldn't listen on 0.0.0.0:25060: [Errno 98] Address already in use无法侦听错误:无法在 0.0.0.0:25060 上侦听:[Errno 98] 地址已在使用中
【发布时间】:2020-02-07 19:36:25
【问题描述】:

我正在安装 CDRTOOL + freeradius + mediaproxy +opensips。 当其他 3 个已完成时,我一直在安装 mediaproxy。

当我运行 mediaproxy-dispatcher 时,

/usr/bin/media-dispatcher --no-fork

我收到以下错误:-

INFO     [main] Starting MediaProxy Dispatcher 2.6.6
INFO     [main] Twisted is using epollreactor
CRITICAL [main] failed to create MediaProxy Dispatcher: Couldn't listen on 0.0.0.0:25060: [Errno 98] Address already in use.
ERROR    [main] Traceback (most recent call last):
ERROR    [main]   File "/usr/bin/media-dispatcher", line 53, in <module>
ERROR    [main]     dispatcher = Dispatcher()
ERROR    [main]   File "/usr/lib/python2.7/dist-packages/mediaproxy/dispatcher.py", line 491, in __init__
ERROR    [main]     self.relay_listener = reactor.listenTLS(dispatcher_port, self.relay_factory, self.tls_context, interface=dispatcher_addr)
ERROR    [main]   File "/usr/lib/python2.7/dist-packages/gnutls/interfaces/twisted/__init__.py", line 351, in listenTLS
ERROR    [main]     p.startListening()
ERROR    [main]   File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 980, in startListening
ERROR    [main]     raise CannotListenError(self.interface, self.port, le)
ERROR    [main] CannotListenError: Couldn't listen on 0.0.0.0:25060: [Errno 98] Address already in use.

我在这里被困了 2-3 天......谁能帮帮我,plzz ??

这是我在终止进程并重新运行它后遇到的错误:-

root@santo-VirtualBox:~# kill 1308
root@santo-VirtualBox:~# /usr/bin/media-dispatcher --no-fork
INFO     [main] Starting MediaProxy Dispatcher 2.6.6
INFO     [main] Twisted is using epollreactor
^CINFO     [main] Received KeyboardInterrupt, exiting.

GARBAGE:
gc: collectable <tuple 0x7fe92ca67950>
gc: collectable <StgDict 0x7fe92cf4e898>
gc: collectable <_ctypes.PyCArrayType 0x5590a63665c0>
gc: collectable <getset_descriptor 0x7fe92ca6b878>
gc: collectable <getset_descriptor 0x7fe92ca6b8c0>
gc: collectable <tuple 0x7fe932a62e10>
gc: collectable <tuple 0x7fe92ca67d50>
gc: collectable <StgDict 0x7fe92cf4ea40>
gc: collectable <_ctypes.PyCArrayType 0x5590a636d900>
gc: collectable <getset_descriptor 0x7fe92ca6b998>
gc: collectable <getset_descriptor 0x7fe92ca6b9e0>
gc: collectable <tuple 0x7fe930e53c00>
gc: collectable <getset_descriptor 0x7fe92ca6ba28>
gc: collectable <getset_descriptor 0x7fe92ca6ba70>

COLLECTABLE CYCLES:
<class 'ctypes.c_char_Array_256'> -> (<class 'ctypes.c_char_Array_256'>, <type '_ctypes.Array'>, <type '_ctypes._CData'>, <type 'object'>) -> <class 'ctypes.c_char_Array_256'>
<class 'ctypes.c_char_Array_256'> -> {'raw': <attribute 'raw' of 'c_char_Array_256' objects>, '__module__': 'ctypes', '__dict__': <attribute '__dict__' of 'c_char_Array_256' objects>, '__weakref__': <attribute '__weakref__' of 'c_char_Array_256' objects>, '_length_': 256, '_type_': <class 'ctypes.c_char'>, '__doc__': None, 'value': <attribute 'value' of 'c_char_Array_256' objects>} -> <attribute 'value' of 'c_char_Array_256' objects> -> <class 'ctypes.c_char_Array_256'>
<class 'ctypes.c_char_Array_256'> -> {'raw': <attribute 'raw' of 'c_char_Array_256' objects>, '__module__': 'ctypes', '__dict__': <attribute '__dict__' of 'c_char_Array_256' objects>, '__weakref__': <attribute '__weakref__' of 'c_char_Array_256' objects>, '_length_': 256, '_type_': <class 'ctypes.c_char'>, '__doc__': None, 'value': <attribute 'value' of 'c_char_Array_256' objects>} -> <attribute 'raw' of 'c_char_Array_256' objects> -> <class 'ctypes.c_char_Array_256'>
<class 'ctypes.c_char_Array_256'> -> {'raw': <attribute 'raw' of 'c_char_Array_256' objects>, '__module__': 'ctypes', '__dict__': <attribute '__dict__' of 'c_char_Array_256' objects>, '__weakref__': <attribute '__weakref__' of 'c_char_Array_256' objects>, '_length_': 256, '_type_': <class 'ctypes.c_char'>, '__doc__': None, 'value': <attribute 'value' of 'c_char_Array_256' objects>} -> <attribute '__weakref__' of 'c_char_Array_256' objects> -> <class 'ctypes.c_char_Array_256'>
<class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'> -> (<class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'>, <type '_ctypes.Array'>, <type '_ctypes._CData'>, <type 'object'>) -> <class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'>
<class 'ctypes.c_char_Array_256'> -> {'raw': <attribute 'raw' of 'c_char_Array_256' objects>, '__module__': 'ctypes', '__dict__': <attribute '__dict__' of 'c_char_Array_256' objects>, '__weakref__': <attribute '__weakref__' of 'c_char_Array_256' objects>, '_length_': 256, '_type_': <class 'ctypes.c_char'>, '__doc__': None, 'value': <attribute 'value' of 'c_char_Array_256' objects>} -> <attribute '__dict__' of 'c_char_Array_256' objects> -> <class 'ctypes.c_char_Array_256'>
<class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'> -> {'__module__': 'gnutls.connection', '__dict__': <attribute '__dict__' of 'LP_gnutls_x509_crt_int_Array_1' objects>, '__weakref__': <attribute '__weakref__' of 'LP_gnutls_x509_crt_int_Array_1' objects>, '_length_': 1, '_type_': <class 'gnutls.library.types.LP_gnutls_x509_crt_int'>, '__doc__': None} -> <attribute '__weakref__' of 'LP_gnutls_x509_crt_int_Array_1' objects> -> <class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'>
<class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'> -> {'__module__': 'gnutls.connection', '__dict__': <attribute '__dict__' of 'LP_gnutls_x509_crt_int_Array_1' objects>, '__weakref__': <attribute '__weakref__' of 'LP_gnutls_x509_crt_int_Array_1' objects>, '_length_': 1, '_type_': <class 'gnutls.library.types.LP_gnutls_x509_crt_int'>, '__doc__': None} -> <attribute '__dict__' of 'LP_gnutls_x509_crt_int_Array_1' objects> -> <class 'gnutls.connection.LP_gnutls_x509_crt_int_Array_1'>

【问题讨论】:

    标签: python-2.7 ip-address


    【解决方案1】:

    检查 1:端口是否可用?

    在开发环境中,此错误通常是在服务(持有)端口资源的服务器崩溃并且没有释放该端口时。

    netstat -lntu
    

    参考https://superuser.com/questions/529830/get-a-list-of-open-ports-in-linux

    每次遇到端口占用错误,请按此步骤操作。

    检查 2:Python 包错误?

    尝试升级或降级您的 python 包版本。有一些错误可能与操作系统和其他依赖项有关。

    pip install my_package_name==1.2.3
    

    我检查了mediaproxy/dispatcher.py 的源代码,但无法在该 repo 的最新分支中找到这些代码行。

    【讨论】:

    • 我已经这样做了...使用它的 PID 杀死进程。杀死进程后,当我运行它时,它只会抛出可收集的垃圾,即 gc
    • 我在杀死进程并重新运行它@Sampath 后附加了输出
    • @santoshkumar - JFI,我认为这个新的 GC 错误只是进展。干得好!
    猜你喜欢
    • 1970-01-01
    • 2022-07-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-22
    • 2023-04-10
    • 2016-08-18
    • 2015-06-04
    • 1970-01-01
    相关资源
    最近更新 更多