Skip to content

fix: filter OSError(EADDRINUSE) from PKCE callback bind as user environment error#1199

Open
EngHabu wants to merge 1 commit into
mainfrom
fix/sentry-53-pkce-port-in-use
Open

fix: filter OSError(EADDRINUSE) from PKCE callback bind as user environment error#1199
EngHabu wants to merge 1 commit into
mainfrom
fix/sentry-53-pkce-port-in-use

Conversation

@EngHabu

@EngHabu EngHabu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

The PKCE authenticator opens a local OAuth callback server (pkce.py::_create_callback_server) that binds the redirect-URI port via asyncio.start_server. When that port is already in use — a stale or concurrent login flow, or another local process holding it — bind raises OSError(EADDRINUSE) ("[Errno 98] address already in use"), which leaks to Sentry either bare or wrapped as RuntimeSystemError("Failed to get signed url...").

The redirect-URI port comes from the backend config, so the SDK cannot pick a different one; freeing the port is a user-environment action, not an SDK bug.

Change

  • Add errno.EADDRINUSE to _USER_ENVIRONMENT_OSERROR_ERRNOS in flyte/_sentry.py so the cause-chain walk in _is_user_error filters it, same as ENOSPC.
  • Test covers both the bare and RuntimeSystemError-wrapped chain.

fixes FLYTE-SDK-53
fixes FLYTE-SDK-57

🤖 Generated with Claude Code

@EngHabu EngHabu added the sentry-fix Fix for an issue surfaced by Sentry label Jun 12, 2026
…onment error

The PKCE authenticator's local OAuth callback server (pkce.py
_create_callback_server) binds the redirect-URI port via
asyncio.start_server. When that port is already in use — a stale or
concurrent login flow, or another local process holding it — bind raises
OSError(EADDRINUSE), which leaks to Sentry bare or wrapped as
RuntimeSystemError('Failed to get signed url...').

The redirect-URI port comes from the backend's config, so the SDK can't
pick a different one; freeing the port is a user-environment action, not
an SDK bug. Add errno.EADDRINUSE to _USER_ENVIRONMENT_OSERROR_ERRNOS so
it's filtered like ENOSPC, and cover both the bare and wrapped chain.

fixes FLYTE-SDK-53
fixes FLYTE-SDK-57

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
@EngHabu EngHabu force-pushed the fix/sentry-53-pkce-port-in-use branch from 6ad9def to 28d9ff2 Compare June 13, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sentry-fix Fix for an issue surfaced by Sentry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant