[Bugfix][TE] Reject MC_IB_PORT=0 instead of disabling every RNIC - #3381
Merged
Conversation
SongOf
requested review from
alogfans,
chestnut-Q,
doujiang24 and
staryxchen
as code owners
August 11, 2026 09:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
loadGlobalConfig validated MC_IB_PORT with val >= 0, so 0 passed and became globalConfig().port. IB port numbers are 1-based: RdmaContext::openRdmaDevice then calls ibv_query_port(ctx, 0, ...) on every device, which fails, so
construct() returns ERR_CONTEXT and each RNIC is disableDeviced. With the topology empty, TransferEngine::init() fails with ERR_DEVICE_NOT_FOUND — one mistyped environment variable takes down all RDMA on the node, and no log
line names the value as the cause.
atoi() returning 0 for unparseable input made this reachable by typo as well: MC_IB_PORT=abc selected port 0 instead of being ignored.
Fix: require val > 0, matching the other bounded knobs in the same function. Out-of-range and unparseable values now keep the default port 1 and log the existing warning.
Module
Type of Change
How Has This Been Tested?
Test commands:
cmake .. -DBUILD_UNIT_TESTS=ON && cmake --build . -j$(nproc)
ctest -R config_test --output-on-failure
Test results:
config_test gains 6 IbPortEnvTest cases: unset default, valid override, and rejection of 0 / 256 / -1 / non-numeric. All pass.
Verified the tests are not inert: with val >= 0 restored, ZeroIsRejected and NonNumericIsRejected fail; with the fix they pass.
Full ctest: 28/31 pass. The 3 failures (tcp_transport_test, transfer_metadata_test, memory_location_test) are pre-existing environment issues in the build container — no etcd metadata server, and no CAP_SYS_NICE for mbind —
and are unrelated to this change.
Checklist
pre-commit was run on the two touched files only (all hooks pass); --all-files was not run because cmake-format rewrites unrelated CMakeLists.txt files. Docs need no change — MC_IB_PORT is documented as "default value 1" and
never advertised 0 as valid.
AI Assistance Disclosure