ComfyUI-Manager icon indicating copy to clipboard operation
ComfyUI-Manager copied to clipboard

The get_client_ip function has a bug

Open ZeeLyn opened this issue 11 months ago • 3 comments

def get_client_ip(request):
    peername = request.transport.get_extra_info("peername")
    if peername is not None:
        host, port = peername
        return host
    
    return "unknown"

The variable peername sometimes returns a value like this ('127.0.0.1', 19260), and sometimes it returns like this ('::1', 28891, 0, 0), throwing an exception: "too many values ​​to unpack". My comfyui desktop is now unable to start normally.

ZeeLyn avatar Dec 10 '25 08:12 ZeeLyn

host, port = peername can be fixed as : host, *_ = peername to solve it

however, i don't find where is the code in this repo to commit it reported location is env name/lib/python3.12/site-packages/comfyui_manager/__init__.py", line 58, in get_client_ip

ZeyuanGuo avatar Dec 22 '25 08:12 ZeyuanGuo

Yes, I couldn't find it either.

ZeeLyn avatar Dec 22 '25 13:12 ZeeLyn

Fixed by #2427, which is in comfyui-manager since 4.0.4: get_client_ip takes the first two values of the peer name, so the four values of an IPv6 address are read as well.

Please open a new issue if it still happens on a current version.

ltdrdata avatar Nov 19 '26 15:11 ltdrdata