Skip to content

fix(monitor): specify errors=replace and guard proc.kill in ClusterStatus.refresh in agent_monitor.py - #2836

Open
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/agent-monitor-cluster-status-error-handling
Open

fix(monitor): specify errors=replace and guard proc.kill in ClusterStatus.refresh in agent_monitor.py#2836
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/agent-monitor-cluster-status-error-handling

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Problem

In ods/extensions/services/dashboard-api/agent_monitor.py, ClusterStatus.refresh() decodes stdout from the cluster proxy subprocess using un-parameterized stdout.decode(). If non-UTF-8 characters are returned by status endpoints, stdout.decode() raises an uncaught UnicodeDecodeError. Additionally, calling proc.kill() when sub-processes have already exited could raise ProcessLookupError inside the asyncio.TimeoutError handler.

Fix

Pass errors="replace" to stdout.decode("utf-8", errors="replace") and wrap proc.kill() in a try...except ProcessLookupError: block in ClusterStatus.refresh().

Verification

Verified syntax with python3 -m py_compile ods/extensions/services/dashboard-api/agent_monitor.py. git diff --check passed cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant