[Bugfix] Eliminate frontend ZMQ port TOCTOU with inherited listeners (#54113)
Signed-off-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
OpenAI Codex
Claude Opus 5.5
parent
fb2ac82458
commit
f226af0e11
+10
-12
@@ -501,8 +501,8 @@ impl SharedRuntimeArgs {
|
||||
self,
|
||||
listen_fd: i32,
|
||||
grpc_listen_fd: Option<i32>,
|
||||
input_address: String,
|
||||
output_address: String,
|
||||
input_listener_fd: i32,
|
||||
output_listener_fd: i32,
|
||||
coordinator_address: Option<String>,
|
||||
engine_start_index: u32,
|
||||
engine_count: usize,
|
||||
@@ -518,8 +518,8 @@ impl SharedRuntimeArgs {
|
||||
|
||||
Config {
|
||||
transport_mode: TransportMode::Bootstrapped {
|
||||
input_address,
|
||||
output_address,
|
||||
input_listener_fd,
|
||||
output_listener_fd,
|
||||
engine_start_index,
|
||||
engine_count,
|
||||
data_parallel_size,
|
||||
@@ -697,14 +697,12 @@ pub struct FrontendArgs {
|
||||
/// supervisor. When not set, no gRPC server is started.
|
||||
#[arg(long)]
|
||||
pub grpc_listen_fd: Option<i32>,
|
||||
/// Frontend input ROUTER socket address that the Python engines will
|
||||
/// connect to.
|
||||
/// Inherited frontend input ROUTER listener file descriptor.
|
||||
#[arg(long)]
|
||||
pub input_address: String,
|
||||
/// Frontend output PULL socket address that the Python engines will push
|
||||
/// responses to.
|
||||
pub input_listener_fd: i32,
|
||||
/// Inherited frontend output PULL listener file descriptor.
|
||||
#[arg(long)]
|
||||
pub output_address: String,
|
||||
pub output_listener_fd: i32,
|
||||
/// Optional Python-owned frontend-side DP coordinator socket address for
|
||||
/// external coordinator mode in the bootstrapped frontend path, i.e.,
|
||||
/// `stats_update_address`.
|
||||
@@ -733,8 +731,8 @@ impl FrontendArgs {
|
||||
self.runtime.into_bootstrapped_config(
|
||||
self.listen_fd,
|
||||
self.grpc_listen_fd,
|
||||
self.input_address,
|
||||
self.output_address,
|
||||
self.input_listener_fd,
|
||||
self.output_listener_fd,
|
||||
self.coordinator_address,
|
||||
self.engine_start_index,
|
||||
self.engine_count,
|
||||
|
||||
@@ -668,10 +668,10 @@ fn frontend_args_json_passes_tls_into_config() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","ssl_certfile":"/tmp/cert.pem","ssl_keyfile":"/tmp/key.pem"}"#,
|
||||
])
|
||||
@@ -693,10 +693,10 @@ fn frontend_args_json_rejects_out_of_range_cert_reqs() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","ssl_certfile":"/tmp/cert.pem","ssl_cert_reqs":5}"#,
|
||||
])
|
||||
@@ -718,10 +718,10 @@ fn frontend_args_json_passes_enable_request_id_headers_into_config() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","enable_request_id_headers":true}"#,
|
||||
])
|
||||
@@ -807,10 +807,10 @@ fn frontend_args_json_passes_lora_modules_into_config() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","lora_modules":[{"name":"alice","path":"org/alice","base_model_name":null,"is_3d_lora_weight":true}]}"#,
|
||||
])
|
||||
@@ -862,10 +862,10 @@ fn frontend_args_json_accepts_api_key_string() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","api_key":"secret"}"#,
|
||||
])
|
||||
@@ -885,10 +885,10 @@ fn frontend_args_json_accepts_api_key_list() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","api_key":["secret-a","secret-b"]}"#,
|
||||
])
|
||||
@@ -991,10 +991,10 @@ fn frontend_args_accept_json() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--coordinator-address",
|
||||
"tcp://127.0.0.1:7000",
|
||||
"--args-json",
|
||||
@@ -1008,8 +1008,8 @@ fn frontend_args_accept_json() {
|
||||
FrontendArgs {
|
||||
listen_fd: 3,
|
||||
grpc_listen_fd: None,
|
||||
input_address: "ipc:///tmp/input.sock",
|
||||
output_address: "ipc:///tmp/output.sock",
|
||||
input_listener_fd: 999999,
|
||||
output_listener_fd: 999998,
|
||||
coordinator_address: Some(
|
||||
"tcp://127.0.0.1:7000",
|
||||
),
|
||||
@@ -1083,10 +1083,10 @@ fn frontend_args_json_applies_defaults() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--engine-count",
|
||||
"4",
|
||||
"--args-json",
|
||||
@@ -1115,10 +1115,10 @@ fn frontend_args_json_ignores_engine_owned_max_model_len() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","max_model_len":-1}"#,
|
||||
])
|
||||
@@ -1165,10 +1165,10 @@ fn hf_overrides_preserve_merge_patch_in_cli_and_python_bootstrap() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
&payload.to_string(),
|
||||
])
|
||||
@@ -1204,10 +1204,10 @@ fn frontend_args_json_accepts_supported_non_default_fields() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","generation_config":"vllm","revision":"release","engine_ready_timeout_secs":42,"tool_call_parser":"hermes","reasoning_parser":"qwen3_thinking","tokenizer_mode":"deepseek_v32","language_model_only":true,"max_logprobs":-1,"shutdown_timeout":3}"#,
|
||||
])
|
||||
@@ -1286,10 +1286,10 @@ fn frontend_args_json_ignores_unknown_fields() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","uds":"/tmp/vllm.sock","nested_unknown":{"x":1}}"#,
|
||||
])
|
||||
@@ -1308,10 +1308,10 @@ fn frontend_args_json_sets_prompt_tokens_details_flag() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","api_server_count":2,"enable_prompt_tokens_details":true}"#,
|
||||
])
|
||||
@@ -1371,10 +1371,10 @@ fn frontend_args_json_parses_cors_fields() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","allowed_origins":["http://a.com"],"allow_credentials":true}"#,
|
||||
])
|
||||
@@ -1396,10 +1396,10 @@ fn frontend_args_json_rejects_unsupported_fields() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","root_path":"/prefix"}"#,
|
||||
])
|
||||
@@ -1423,10 +1423,10 @@ fn frontend_args_json_aggregates_multiple_unsupported_fields() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","response_role":"assistant","root_path":"/prefix"}"#,
|
||||
])
|
||||
@@ -1452,10 +1452,10 @@ fn frontend_args_json_rejects_malformed_json() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B""#,
|
||||
])
|
||||
@@ -1999,10 +1999,10 @@ fn frontend_args_reject_legacy_handshake_flags() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B"}"#,
|
||||
"--handshake-address",
|
||||
@@ -2043,10 +2043,10 @@ fn frontend_config_uses_external_coordinator_when_coordinator_address_is_present
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--coordinator-address",
|
||||
"tcp://127.0.0.1:7000",
|
||||
"--engine-start-index",
|
||||
@@ -2068,8 +2068,8 @@ fn frontend_config_uses_external_coordinator_when_coordinator_address_is_present
|
||||
expect![[r#"
|
||||
Config {
|
||||
transport_mode: Bootstrapped {
|
||||
input_address: "ipc:///tmp/input.sock",
|
||||
output_address: "ipc:///tmp/output.sock",
|
||||
input_listener_fd: 999999,
|
||||
output_listener_fd: 999998,
|
||||
engine_start_index: 3,
|
||||
engine_count: 1,
|
||||
data_parallel_size: 4,
|
||||
@@ -2200,10 +2200,10 @@ fn frontend_config_adopts_inherited_grpc_listener() {
|
||||
"3",
|
||||
"--grpc-listen-fd",
|
||||
"4",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","grpc_port":50051}"#,
|
||||
])
|
||||
@@ -2227,10 +2227,10 @@ fn frontend_args_json_enables_profiling_when_profiler_config_set() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","profiler_config":{"profiler":"torch","torch_profiler_dir":"/tmp/profile"}}"#,
|
||||
])
|
||||
@@ -2251,10 +2251,10 @@ fn frontend_args_json_disables_profiling_when_profiler_config_absent() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B"}"#,
|
||||
])
|
||||
@@ -2275,10 +2275,10 @@ fn frontend_args_json_disables_profiling_when_profiler_type_is_null() {
|
||||
"frontend",
|
||||
"--listen-fd",
|
||||
"3",
|
||||
"--input-address",
|
||||
"ipc:///tmp/input.sock",
|
||||
"--output-address",
|
||||
"ipc:///tmp/output.sock",
|
||||
"--input-listener-fd",
|
||||
"999999",
|
||||
"--output-listener-fd",
|
||||
"999998",
|
||||
"--args-json",
|
||||
r#"{"model_tag":"Qwen/Qwen3-0.6B","profiler_config":{"profiler":null}}"#,
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user