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 10, 05:15 UTC
nixl_connector: export UCX_MEM_MMAP_HOOK_MODE=none to avoid a UCX memory leak (#32181)
Signed-off-by: Mathis Felardos <mathis@mistral.ai>
Mathis Felardos committed
Jan 13, 2026 at 17:21 UTC
4f3676e72628ac067330e3acbf769d92afc2f7ea
1 file changed
+17
vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py
+17
@@ -4,7 +4,9 @@ import contextlib
4
import copy
5
import logging
6
import math
7
+import os
8
import queue
9
+import sys
10
import threading
11
import time
12
import uuid
@@ -87,6 +89,21 @@ logger = init_logger(__name__)
89
90
# Lazy import nixl_wrapper to avoid loading nixl_bindings if nixl is not used
91
try:
92
+ if "UCX_MEM_MMAP_HOOK_MODE" not in os.environ:
93
+ # avoid a memory leak in UCX when using NIXL on some models
94
+ # see: https://github.com/vllm-project/vllm/issues/24264
95
+ if "nixl" in sys.modules or "rixl" in sys.modules:
96
+ logger.warning(
97
+ "NIXL was already imported, we can't disable UCX mmap hooks. "
98
+ "Please set UCX_MEM_MMAP_HOOK_MODE to 'none' manually."
99
+ )
100
+ else:
101
+ logger.info(
102
+ "Setting UCX_MEM_MMAP_HOOK_MODE to 'none' to avoid a rare "
103
+ "memory leak in UCX when using NIXL."
104
+ )
105
+ os.environ["UCX_MEM_MMAP_HOOK_MODE"] = "none"
106
+
107
if not current_platform.is_rocm():
108
from nixl._api import nixl_agent as NixlWrapper
109
from nixl._bindings import nixlXferTelemetry