Crash the server correctly during error (#2231)

This commit is contained in:
Lianmin Zheng
2024-11-28 00:22:39 -08:00
committed by GitHub
parent db674e3d24
commit d4fc1a70e3
46 changed files with 147 additions and 139 deletions

View File

@@ -22,7 +22,7 @@ from sglang.bench_serving import run_benchmark
from sglang.global_config import global_config
from sglang.lang.backend.openai import OpenAI
from sglang.lang.backend.runtime_endpoint import RuntimeEndpoint
from sglang.srt.utils import get_bool_env_var, kill_child_process
from sglang.srt.utils import get_bool_env_var, kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.utils import get_exception_traceback
@@ -504,7 +504,7 @@ def run_unittest_files(files: List[str], timeout_per_file: float):
)
assert ret_code == 0
except TimeoutError:
kill_child_process(process.pid, include_self=True)
kill_process_tree(process.pid)
time.sleep(5)
print(
f"\nTimeout after {timeout_per_file} seconds when running {filename}\n",
@@ -578,7 +578,7 @@ def run_bench_serving(
run_benchmark(warmup_args)
res = run_benchmark(args)
finally:
kill_child_process(process.pid, include_self=True)
kill_process_tree(process.pid)
assert res["completed"] == num_prompts
return res
@@ -611,7 +611,7 @@ def run_bench_one_batch(model, other_args):
lastline = output.split("\n")[-3]
output_throughput = float(lastline.split(" ")[-2])
finally:
kill_child_process(process.pid, include_self=True)
kill_process_tree(process.pid)
return output_throughput
@@ -710,8 +710,8 @@ def run_and_check_memory_leak(
workload_func(base_url, model)
# Clean up everything
kill_child_process(process.pid, include_self=True)
kill_child_process(process.pid, include_self=True)
kill_process_tree(process.pid)
kill_process_tree(process.pid)
stdout.close()
stderr.close()
if os.path.exists(STDOUT_FILENAME):