소스 검색

Avoid waiting for zombie processes in `synctl stop` (#11490)

tags/v1.49.0rc1
Sean Quah 2 년 전
committed by GitHub
부모
커밋
b50e39df57
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
2개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제
  1. +1
    -0
      changelog.d/11490.feature
  2. +16
    -3
      synctl

+ 1
- 0
changelog.d/11490.feature 파일 보기

@@ -0,0 +1 @@
`synctl stop` will now wait for Synapse to exit before returning.

+ 16
- 3
synctl 파일 보기

@@ -41,11 +41,24 @@ NORMAL = "\x1b[m"
def pid_running(pid):
try:
os.kill(pid, 0)
return True
except OSError as err:
if err.errno == errno.EPERM:
return True
return False
pass # process exists
else:
return False

# When running in a container, orphan processes may not get reaped and their
# PIDs may remain valid. Try to work around the issue.
try:
with open(f"/proc/{pid}/status") as status_file:
if "zombie" in status_file.read():
return False
except Exception:
# This isn't Linux or `/proc/` is unavailable.
# Assume that the process is still running.
pass

return True


def write(message, colour=NORMAL, stream=sys.stdout):


불러오는 중...
취소
저장