You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature request] Support connect to ipv6 address #1252
debugpy works well with ipv4,
now I are trying to use ipv6 , and obtain : Error: invalid --connect <address>: invalid port number
I tried to modify debugpy/server/cli.py to fix address parse error:
def set_address(mode):
def do(arg, it):
if options.address is not None:
raise ValueError("--listen and --connect are mutually exclusive")
# It's either host:port, or just port.
value = next(it)
def get_host_port(address):
parts = address.split(":")
host = ":".join(parts[:-1])
if host == "":
host = "127.0.0.1"
port = parts[-1]
return host, port
host, port = get_host_port(value)
#host, sep, port = value.partition(":")
#if not sep:
# host = "127.0.0.1"
# port = value
try:
port = int(port)
except Exception:
port = -1
if not (0 <= port < 2 ** 16):
raise ValueError("invalid port number")
options.mode = mode
options.address = (host, port)
return do
rerun and obtain:
File "debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 491, in start_client
s.connect((host, port))
socket.gaierror: [Errno -9] Address family for hostname not supported
+1 I need this feature please, I don't know why it doesn't work anymore I used to debug my apps inside containers with ipv6 only scenarios some months ago but something changed in latest versions that will make debugpy only listen on 0.0.0.0 even if there's no ipv4 in the container
I've been trying to adapt debugpy code to use ipv6 but it seems like pydevd vendored subfolder also has a lot of ipv4-only sock usage so I get output like this:
object address : 0x780f0377fc80
object refcount : 6
object type : 0x21eb1a0
object type name: gaierror
object repr : gaierror(-9, 'Address family for hostname not supported')
lost sys.stderr
please if there's some python genius around give us a hand I really would like to have this to be able to debug my containers in ipv6 only cluster
meanwhile it gets supported by the pydevd code, I've found a workaround that works easily with kubectl and vscode using debug attach (python option from the dropdown list).
I don't even need to add a containerPort to the pod yaml.
using apk package in alpine container called 6tunnel
side note:
don't use snap provided kubectl because it doesn't work so well (use the one from apt/apk or download manually)
So trying to bind to "::" (IPv6) directly won’t work — even though Fly's internal networking and tcpdump show IPv6 traffic, your Python runtime or OS layer doesn’t support binding to it.
Why?
::1 = IPv6 loopback (like 127.0.0.1 for IPv6)
:: = all IPv6 interfaces (like 0.0.0.0)
Fly’s proxy connects to your app via its internal IPv6 network (not ::1)
Whereas, if 6tunnel is only listening on ::1, Fly can’t reach it.
Activity
gattytto commentedon Jul 17, 2024
+1 I need this feature please, I don't know why it doesn't work anymore I used to debug my apps inside containers with ipv6 only scenarios some months ago but something changed in latest versions that will make debugpy only listen on 0.0.0.0 even if there's no ipv4 in the container
gattytto commentedon Jul 24, 2024
the relevant code is here
this needs to be extended so when address is not ipv4 but rather ipv6, it needs to be something like:
rchiodo commentedon Jul 24, 2024
If you're willing to try, we accept PRs. Sounds like you found where the problem is.
gattytto commentedon Jul 24, 2024
I don't think I'm that good of a dev but I will give it a try xD
gattytto commentedon Jul 25, 2024
I've been trying to adapt debugpy code to use ipv6 but it seems like pydevd vendored subfolder also has a lot of ipv4-only sock usage so I get output like this:
please if there's some python genius around give us a hand I really would like to have this to be able to debug my containers in ipv6 only cluster
gattytto commentedon Jul 28, 2024
meanwhile it gets supported by the pydevd code, I've found a workaround that works easily with kubectl and vscode using debug attach (python option from the dropdown list).
I don't even need to add a containerPort to the pod yaml.
using apk package in alpine container called 6tunnel
side note:
don't use snap provided kubectl because it doesn't work so well (use the one from apt/apk or download manually)
mrjcleaver commentedon Mar 26, 2025
I'm hitting this on fly.io
And
And in vs-code:
root@148e455c103908:/app# tcpdump -v -n port 5678
Which indicates (per ChatGPT):
mrjcleaver commentedon Mar 26, 2025
Using gattytto (@gattytto) 's solution:
However, Bind 6tunnel to :: instead of ::1
So now your code can go back to:
With:
Referenced from https://community.fly.io/t/debugpy-on-fly-io-ipv4-ipv6-workaround-for-vs-code/24375