[PR #779] fix: parse the full /proc/self/maps pathname in check_nccl_so #777

Open
opened 2026-10-27 21:06:15 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepEP/pull/779
Author: @li-lizhe
Created: 10/13/2026
Status: 🔄 Open

Base: main ← Head: fix/nccl-deleted-mapping-parse


📝 Commits (1)

  • d519401 fix: parse the full /proc/self/maps pathname in check_nccl_so

📊 Changes

1 file changed (+19 additions, -1 deletions)

View changed files

📝 deep_ep/__init__.py (+19 -1)

📄 Description

Fixes #777.

check_nccl_so() identifies the mapped NCCL library with line.strip().split(' ')[-1], which is the last space-separated token, not the pathname field of /proc/self/maps:

  • a pathname that contains a space is truncated, so the wrong file is handed to filecmp.cmp();
  • a mapping whose backing inode was replaced or removed is reported with a trailing (deleted) marker, so the token is literally (deleted) and the check dies with
FileNotFoundError: [Errno 2] No such file or directory: '(deleted)'

That is the traceback in #777: it aborts the import long before any NCCL version comparison happens, and hides the actual condition.

Change (deep_ep/__init__.py, +19/-1)

  • Read the pathname field (sixth field) of each /proc/self/maps line instead of the last token.
  • Strip the (deleted) marker and raise an explicit AssertionError naming the library and the likely cause (the NCCL library changed underneath a running process, e.g. a concurrent pip install) instead of surfacing a bare FileNotFoundError.
  • The duplicate-runtime and version-comparison logic is unchanged.

Verification

The real check_nccl_so() is extracted from both revisions by AST and executed against synthetic /proc/self/maps content (filecmp.cmp and glob stubbed with a fixed file set; stdlib only, no torch / NCCL import needed):

case before after
plain pathname returns normally returns normally
pathname containing a space FileNotFoundError: 'nccl/lib/libnccl.so.2' returns normally
(deleted) mapping FileNotFoundError: '(deleted)' AssertionError: The NCCL library mapped as /root/nccl/lib/libnccl.so.2 was replaced or removed while it was still mapped ...
two different libnccl mappings duplicate-runtime AssertionError duplicate-runtime AssertionError (unchanged)

Not tested: an actual import deep_ep / check_nccl_so() run on a machine with NCCL and a GPU (no such environment was available, so the version-comparison path against a real loaded library is exercised only through the stubbed harness above).

Signed-off-by: li-lizhe 147392333@qq.com


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepEP/pull/779 **Author:** [@li-lizhe](https://github.com/li-lizhe) **Created:** 10/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/nccl-deleted-mapping-parse` --- ### 📝 Commits (1) - [`d519401`](https://github.com/deepseek-ai/DeepEP/commit/d51940144b30b38a2df4bf97bba610049d226937) fix: parse the full /proc/self/maps pathname in check_nccl_so ### 📊 Changes **1 file changed** (+19 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `deep_ep/__init__.py` (+19 -1) </details> ### 📄 Description Fixes #777. `check_nccl_so()` identifies the mapped NCCL library with `line.strip().split(' ')[-1]`, which is the *last space-separated token*, not the pathname field of `/proc/self/maps`: - a pathname that contains a space is truncated, so the wrong file is handed to `filecmp.cmp()`; - a mapping whose backing inode was replaced or removed is reported with a trailing ` (deleted)` marker, so the token is literally `(deleted)` and the check dies with ```text FileNotFoundError: [Errno 2] No such file or directory: '(deleted)' ``` That is the traceback in #777: it aborts the import long before any NCCL version comparison happens, and hides the actual condition. ### Change (`deep_ep/__init__.py`, +19/-1) - Read the pathname field (sixth field) of each `/proc/self/maps` line instead of the last token. - Strip the ` (deleted)` marker and raise an explicit `AssertionError` naming the library and the likely cause (the NCCL library changed underneath a running process, e.g. a concurrent `pip install`) instead of surfacing a bare `FileNotFoundError`. - The duplicate-runtime and version-comparison logic is unchanged. ### Verification The real `check_nccl_so()` is extracted from both revisions by AST and executed against synthetic `/proc/self/maps` content (`filecmp.cmp` and `glob` stubbed with a fixed file set; stdlib only, no torch / NCCL import needed): | case | before | after | |---|---|---| | plain pathname | returns normally | returns normally | | pathname containing a space | `FileNotFoundError: 'nccl/lib/libnccl.so.2'` | returns normally | | ` (deleted)` mapping | `FileNotFoundError: '(deleted)'` | `AssertionError: The NCCL library mapped as /root/nccl/lib/libnccl.so.2 was replaced or removed while it was still mapped ...` | | two different libnccl mappings | duplicate-runtime `AssertionError` | duplicate-runtime `AssertionError` (unchanged) | Not tested: an actual `import deep_ep` / `check_nccl_so()` run on a machine with NCCL and a GPU (no such environment was available, so the version-comparison path against a real loaded library is exercised only through the stubbed harness above). Signed-off-by: li-lizhe <147392333@qq.com> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#777
No description provided.