File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 55import os
66import re
77import signal
8+ import socket
89import tempfile
910from argparse import Namespace
1011from contextlib import asynccontextmanager
@@ -525,6 +526,9 @@ async def run_server(args, **uvicorn_kwargs) -> None:
525526 logger .info ("vLLM API server version %s" , VLLM_VERSION )
526527 logger .info ("args: %s" , args )
527528
529+ temp_socket = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
530+ temp_socket .bind (("" , args .port ))
531+
528532 def signal_handler (* _ ) -> None :
529533 # Interrupt server on sigterm while initializing
530534 raise KeyboardInterrupt ("terminated" )
@@ -541,6 +545,8 @@ def signal_handler(*_) -> None:
541545 model_config = await async_engine_client .get_model_config ()
542546 init_app_state (async_engine_client , model_config , app .state , args )
543547
548+ temp_socket .close ()
549+
544550 shutdown_task = await serve_http (
545551 app ,
546552 limit_concurrency = async_engine_client .limit_concurrency ,
You can’t perform that action at this time.
0 commit comments