hermes - 💡(How to fix) Fix os.kill(pid, 0) raises SystemError on Windows in get_running_pid(), crashing hermes gateway [1 pull requests]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

SystemError: <built-in function kill> returned a result with an exception set In gateway/status.py, the get_running_pid() function uses os.kill(pid, 0) to check if a process is alive. On Windows, signal 0 is not supported. While the code has an except OSError handler (comment says Windows raises OSError with WinError 87), the actual exception raised is SystemError, which is not caught.

Traceback

SystemError: <built-in function kill> returned a result with an exception set

Root Cause

In gateway/status.py, the get_running_pid() function uses os.kill(pid, 0) to check if a process is alive. On Windows, signal 0 is not supported. While the code has an except OSError handler (comment says Windows raises OSError with WinError 87), the actual exception raised is SystemError, which is not caught.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Bug Description

After running hermes update on Windows 11 (10.0.28000), executing hermes gateway crashes immediately with:

OSError: [WinError 87] 参数错误。

Followed by:

SystemError: <built-in function kill> returned a result with an exception set

Root Cause

In gateway/status.py, the get_running_pid() function uses os.kill(pid, 0) to check if a process is alive. On Windows, signal 0 is not supported. While the code has an except OSError handler (comment says Windows raises OSError with WinError 87), the actual exception raised is SystemError, which is not caught.

Traceback

File `...gateway/run.py`, line 15063, in start_gateway existing_pid = get_running_pid() File `...gateway/status.py`, line 828, in get_running_pid os.kill(pid, 0) # signal 0 = existence check, no actual signal sent SystemError: <built-in function kill> returned a result with an exception set

Environment

  • OS: Windows 11 (10.0.28000, x64)
  • Python: 3.12.8
  • Install method: Native (hermes update)
  • Command: hermes gateway

Suggested Fix

In gateway/status.py, get_running_pid(), add a SystemError handler alongside the existing OSError handler:

python except OSError: # Windows raises OSError with WinError 87 for an invalid pid continue except SystemError: # Windows: os.kill(pid, 0) raises SystemError when signal 0 is unsupported continue

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING