Repository navigation
fix(agent): prevent panic when controller_ips is empty in remaining l… - #11947
Open
YanLongDai wants to merge 1 commit into
Open
YanLongDai wants to merge 1 commit into
YanLongDai wants to merge 1 commit into
Conversation
…ocations - Replace config.controller_ips[0] with config.controller_ips.first() in Trident::run() function (line 720) - Replace config.controller_ips[0] with config.controller_ips.first() in Synchronizer::new() call (line 848) - Replace config.controller_ips[0] with config.controller_ips.first() in SidecarPoller::new() call (line 971) - Add proper error handling with clear error message - Prevents panic when controller_ips Vec is empty in standalone mode Fixes: Agent crash with signal 6 (SIGABRT) at trident.rs:720, 848, 971 Signed-off-by: Dai Yanlong <daiyanlong@kylinos.cn>
This branch has not been deployed
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.
This PR is for:
Fixes controller_ips[0] index out of bounds panic in remaining locations
Steps to reproduce the bug
This PR fixes the same
controller_ips[0]index out of bounds issue in the remaining 3 locations inagent/src/trident.rs, following the same approach as PR #11929.controller-ipsfield:systemctl start deepflow-agentWhen the agent starts without
controller-ipsconfigured, it may panic at different locations depending on the execution path:Trident::run()function (eBPF initialization path)Synchronizer::new()call (config sync path)SidecarPoller::new()call (sidecar mode path)Stack trace example (Line 720):
Test environment:
Verification:
Conclusion: This is a bug in the native DeepFlow code, verified on community version v7.2.2.
Changes to fix the bug
Location 1: Trident::run() - Line 720
Before:
After:
Location 2: Synchronizer::new() - Line 848
Before:
After:
config_handler .static_config .controller_ips .first() .ok_or_else(|| { anyhow::anyhow!( "controller_ips is empty, please configure controller-ips in standalone mode" ) })? .clone(),Location 3: SidecarPoller::new() - Line 971
Before:
After:
config_handler .static_config .controller_ips .first() .ok_or_else(|| { anyhow::anyhow!( "controller_ips is empty, please configure controller-ips in standalone mode" ) })? .parse()?,Affected branches
Related PR
Checklist
Note: The eBPF verification items are not applicable for this fix as it only modifies configuration parsing logic, not eBPF programs.
Signed-off-by: Dai Yanlong daiyanlong@kylinos.cn
cc @lzf575 @rvql Please review this fix. Thanks!