[Feature] Add graceful scheduler shutdown; free hisparse host buffer on exit (#28779)

This commit is contained in:
Liangsheng Yin
2026-06-21 15:08:10 -07:00
committed by GitHub
parent 8e890391f5
commit e6722c751b
7 changed files with 107 additions and 2 deletions
@@ -1,5 +1,8 @@
import subprocess
import time
import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
@@ -49,6 +52,18 @@ class TestGLM5HiSparse(DefaultServerBase, GSM8KMixin):
gsm8k_num_threads = 100
gsm8k_num_shots = 24
@classmethod
def tearDownClass(cls):
# HiSparse's large pinned host buffer stalls an external SIGKILL teardown
# (kernel unpin). Drive the server's own graceful shutdown so each rank
# unregisters in userspace; hard-kill as a fallback.
cls.process.terminate()
try:
cls.process.wait(timeout=90)
except subprocess.TimeoutExpired:
kill_process_tree(cls.process.pid, wait_timeout=60)
time.sleep(2)
if __name__ == "__main__":
unittest.main()