Skip to content

bug: bare except clauses in API server silently swallow SystemExit/KeyboardInterrupt #5363

@Saatvik-GT

Description

@Saatvik-GT

Describe the bug

_match_versions and _match_events in gcp/api/server.py use bare except: clauses which catch all exceptions including SystemExit and KeyboardInterrupt. This can silently swallow fatal signals, making the server appear to hang rather than exit cleanly. Additionally, the same blocks log at ERROR level for a case the existing TODO(michaelkedar): This log is noisy comment acknowledges is expected — and a dead source_path: str type annotation in frontend_handlers.py looks like an uninitialized variable but is actually already bound earlier in the function.

To Reproduce

Trigger a KeyboardInterrupt or SystemExit while _match_versions or _match_events is executing in gcp/api/server.py
The exception is silently caught by the bare except: block and swallowed — the server does not exit as expected
Expected behaviour

Bare except: should be except Exception: so fatal signals are not caught
The ecosystem helper failure should log at DEBUG, not ERROR, since it is an expected/recoverable case
The dead source_path: str annotation in add_source_info (frontend_handlers.py ~line 532) should be removed to avoid misleading readers into thinking the variable is uninitialized

Additional context

Affected locations:

gcp/api/server.py — _match_versions (~lines 1035, 1045) and _match_events (~lines 1082, 1092)
gcp/website/frontend_handlers.py — add_source_info (~line 532)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions