# HG changeset patch # User RhodeCode Admin # Date 2023-02-01 20:35:47 # Node ID f20a077bd8258f085e3b3f459483b169d6d1db75 # Parent a1b8e0e6cff3e23e1af347573d75cb2fcda08ba2 utils: catch error: [Errno 98] Address already in use errors diff --git a/rhodecode/lib/utils2.py b/rhodecode/lib/utils2.py --- a/rhodecode/lib/utils2.py +++ b/rhodecode/lib/utils2.py @@ -36,6 +36,7 @@ import urlobject import uuid import getpass import socket +import errno import random from functools import update_wrapper, partial, wraps @@ -1201,7 +1202,11 @@ def get_available_port(min_port=40000, m sock.close() break except OSError: - pass + continue + except socket.error as e: + if e.args[0] in [errno.EADDRINUSE, errno.ECONNREFUSED]: + continue + raise del sock return pick_port