@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / d65798f78c
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 16, 15:45 UTC

[Core] zmq: bind only to 127.0.0.1 for local-only usage (#8543)

Signed-off-by: Russell Bryant <rbryant@redhat.com>

Russell Bryant committed Sep 18, 2024 at 12:10 UTC d65798f78c76f03f068fc2f69a68cff430ee6b6f
1 file changed +11 -6
vllm/distributed/device_communicators/shm_broadcast.py
+11 -6
@@ -196,7 +196,9 @@ class MessageQueue:
196 # see http://api.zeromq.org/3-3:zmq-setsockopt for more details
197 self.local_socket.setsockopt(XPUB_VERBOSE, True)
198 local_subscribe_port = get_open_port()
199 - self.local_socket.bind(f"tcp://*:{local_subscribe_port}")
199 + socket_addr = f"tcp://127.0.0.1:{local_subscribe_port}"
200 + logger.debug("Binding to %s", socket_addr)
201 + self.local_socket.bind(socket_addr)
202
203 self.current_idx = 0
204
@@ -212,7 +214,8 @@ class MessageQueue:
214 self.remote_socket = context.socket(XPUB)
215 self.remote_socket.setsockopt(XPUB_VERBOSE, True)
216 remote_subscribe_port = get_open_port()
215 - self.remote_socket.bind(f"tcp://*:{remote_subscribe_port}")
217 + socket_addr = f"tcp://*:{remote_subscribe_port}"
218 + self.remote_socket.bind(socket_addr)
219
220 else:
221 remote_subscribe_port = None
@@ -255,8 +258,9 @@ class MessageQueue:
258
259 self.local_socket = context.socket(SUB)
260 self.local_socket.setsockopt_string(SUBSCRIBE, "")
258 - self.local_socket.connect(
259 - f"tcp://{handle.connect_ip}:{handle.local_subscribe_port}")
261 + socket_addr = f"tcp://127.0.0.1:{handle.local_subscribe_port}"
262 + logger.debug("Connecting to %s", socket_addr)
263 + self.local_socket.connect(socket_addr)
264
265 self.remote_socket = None
266 else:
@@ -270,8 +274,9 @@ class MessageQueue:
274
275 self.remote_socket = context.socket(SUB)
276 self.remote_socket.setsockopt_string(SUBSCRIBE, "")
273 - self.remote_socket.connect(
274 - f"tcp://{handle.connect_ip}:{handle.remote_subscribe_port}")
277 + socket_addr = f"tcp://{handle.connect_ip}:{handle.remote_subscribe_port}"
278 + logger.debug("Connecting to %s", socket_addr)
279 + self.remote_socket.connect(socket_addr)
280
281 return self
282