-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[BugFix] Fix multiprocessing shutdown errors #7041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
7558b93
17ef6cc
fa76ccc
5432d4e
4832bd6
5fe1017
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,28 +308,35 @@ async def run_server(args, llm_engine=None, **uvicorn_kwargs) -> None: | |
logger.info("vLLM API server version %s", VLLM_VERSION) | ||
logger.info("args: %s", args) | ||
|
||
server = await build_server( | ||
args, | ||
llm_engine, | ||
**uvicorn_kwargs, | ||
) | ||
|
||
loop = asyncio.get_running_loop() | ||
|
||
server_task = loop.create_task(server.serve()) | ||
|
||
def signal_handler() -> None: | ||
# prevents the uvicorn signal handler to exit early | ||
server_task.cancel() | ||
|
||
loop.add_signal_handler(signal.SIGINT, signal_handler) | ||
loop.add_signal_handler(signal.SIGTERM, signal_handler) | ||
|
||
try: | ||
await server_task | ||
except asyncio.CancelledError: | ||
print("Gracefully stopping http server") | ||
await server.shutdown() | ||
server = await build_server( | ||
args, | ||
llm_engine, | ||
**uvicorn_kwargs, | ||
) | ||
|
||
loop = asyncio.get_running_loop() | ||
|
||
server_task = loop.create_task(server.serve()) | ||
|
||
def signal_handler() -> None: | ||
# prevents the uvicorn signal handler to exit early | ||
server_task.cancel() | ||
|
||
loop.add_signal_handler(signal.SIGINT, signal_handler) | ||
loop.add_signal_handler(signal.SIGTERM, signal_handler) | ||
|
||
try: | ||
await server_task | ||
except asyncio.CancelledError: | ||
print("Gracefully stopping http server") | ||
await server.shutdown() | ||
finally: | ||
# Clean up globals | ||
for var in ("openai_serving_chat", "openai_serving_completion", | ||
"openai_serving_embedding", "openai_serving_tokenization", | ||
"engine_args", "engine"): | ||
globals().pop(var, None) | ||
Comment on lines
+338
to
+342
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @youkaichao we'd have to check and The way globals are used here is already hacky imo and I think we'll clean it up later. I wanted to keep this change as simple as possible as there are overlapping changes in #6883 which will be merged very soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it. this is a minor concern, and you can skip it if it is difficult to solve. the most important part is still make the ci pass 🙏 |
||
|
||
|
||
if __name__ == "__main__": | ||
|
Uh oh!
There was an error while loading. Please reload this page.