Skip to content

Conversation

ovidiusm
Copy link
Contributor

@ovidiusm ovidiusm commented Oct 6, 2025

Cherry-pick of #860

Root cause:

  • When hwloc_topology_load() failed, it left hwloc_topology in a partially initialized state
  • The constructor would throw an exception, triggering the destructor
  • The destructor would attempt to destroy the same partially initialized topology, causing a double-free segmentation fault

Changes:

  • Add proper null pointer initialization and verification throughout the function
  • Implement safe cleanup in error paths to prevent double-free conditions
  • Add multiple safety checks before and after hwloc operations
  • Ensure hwloc_topology_destroy() is only called on valid topology objects

What?

Describe what this PR is doing.

Why?

Justification for the PR. If there is an existing issue/bug, please reference it. For
bug fixes, the 'Why?' and 'What?' can be merged into a single item.

How?

It is optional, but for complex PRs, please provide information about the design,
architecture, approach, etc.

…lization

Root cause:
- When hwloc_topology_load() failed, it left hwloc_topology in a partially initialized state
- The constructor would throw an exception, triggering the destructor
- The destructor would attempt to destroy the same partially initialized
  topology, causing a double-free segmentation fault

Changes:
- Add proper null pointer initialization and verification throughout the function
- Implement safe cleanup in error paths to prevent double-free conditions
- Add multiple safety checks before and after hwloc operations
- Ensure hwloc_topology_destroy() is only called on valid topology objects
@ovidiusm
Copy link
Contributor Author

ovidiusm commented Oct 6, 2025

/build

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

👋 Hi ovidiusm! Thank you for contributing to ai-dynamo/nixl.

Your PR reviewers will review your contribution then trigger the CI to test your changes.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants