<#1273 Fix: SSH/VS Code debug entrypoint re-binds ...
# flyte-github
a
#1273 Fix: SSH/VS Code debug entrypoint re-binds debug port (Errno 98) Pull request opened by kumare3 Problem When you open the SSH debugger and run the remote debugger, it fails:
Copy code
OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 2222): [errno 98] address already in use
The generated
.flyte-ssh-debug/flyte-debug-task.sh
re-executes the task entrypoint (
runtime.py main
) under pdb. But the pod still has
_F_E_SSH
(and
_F_SSH_PK
) set in its environment, so
runtime.py
thinks it should start a second SSH server: ssh_debug = os.getenv(FLYTE_ENABLE_SSH_KEY, "").lower() in ("1", "true", "yes") if ssh_debug and name == "a0": asyncio.run(_start_ssh_server(ctx)) # <-- tries to bind :2222 again
:2222
is already held by the SSH server you connected through, so it crashes. The same flaw exists on the VS Code "Interactive Debugging" (F5) path, which re-runs the entrypoint with `_F_E_VS`/`_F_E_SSH` still set. Fix Clear the debug-mode env vars on both debug-launch paths so the entrypoint runs the task body instead of re-starting a server: •
flyte-debug-task.sh
(pdb path)
now `unset`s
_F_E_SSH _F_E_VS
before `exec`'ing pdb. •
launch.json
"Interactive Debugging" (F5 path)
now sets an
env
override clearing both vars. • Added
FLYTE_ENABLE_VSCODE_KEY
to
constants.py
(it only had the SSH key) and imported both keys in
ssh.py
/
vscode.py
instead of hardcoding the strings. With the vars cleared, `ssh_debug`/`debug` evaluate to
False
, the entrypoint skips the server-start branch, and the debugger drops straight into the task body.
Note: the script/launch.json are generated at pod startup, so this takes effect for debug pods launched after a rebuild including these changes — an already-running debug pod still has the old script.
🤖 Generated with Claude Code flyteorg/flyte-sdk