[Bugfix][NixlPush] Guard _remote_agents read in _do_send_reg_notif (X1) (#56317)

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
This commit is contained in:
Nicolò Lucchesi
2026-09-14 18:37:12 +08:00
committed by GitHub
parent ea723c81c3
commit 0ca7aef4e3
3 changed files with 111 additions and 2 deletions
@@ -3264,7 +3264,10 @@ class NixlBaseConnectorWorker:
# Notif-only engines (push-mode D side) have no descriptor state.
for handle in self.dst_xfer_side_handles.pop(engine_id, {}).values():
self.nixl_wrapper.release_dlist_handle(handle)
for agent_name in self._remote_agents.pop(engine_id).values():
# Pop under the handshake lock; NIXL teardown stays outside it.
with self._handshake_lock:
agents = self._remote_agents.pop(engine_id)
for agent_name in agents.values():
self.nixl_wrapper.remove_remote_agent(agent_name)
self.kv_caches_base_addr.pop(engine_id, None)
@@ -354,7 +354,9 @@ class NixlPushConnectorWorker(NixlBaseConnectorWorker):
def _do_send_reg_notif(self, req_id: str, reg_data: dict[str, Any]) -> None:
engine_id = reg_data["remote_engine_id"]
notif_msg = PUSH_REG_NOTIF_PREFIX + msgspec.msgpack.encode(reg_data)
agents = self._remote_agents.get(engine_id)
# _remote_agents is mutated on other threads; snapshot under the lock.
with self._handshake_lock:
agents = dict(self._remote_agents.get(engine_id) or {})
if not agents:
logger.error(
"No remote agents for engine %s; cannot send registration for %s",