fix(helper-rust): treat cleared shmem as no-config rather than error#3876
Open
cataphract wants to merge 1 commit into
Open
fix(helper-rust): treat cleared shmem as no-config rather than error#3876cataphract wants to merge 1 commit into
cataphract wants to merge 1 commit into
Conversation
When the sidecar's last runtime for a target disconnects, expired() clears the shmem file (size=1, NUL byte). A freshly-started sidecar's Service::new() calls poll_and_apply_rc(), which reads this cleared state and gets an empty data slice. ConfigDirectory::runtime_id() and iter() were erroring with "No LF in remote config" instead of treating empty data as "no config available". Libdatadog's own RemoteConfigManager::fetch_update() already handles this correctly with an explicit if !data.is_empty() guard. Mirror that here: add is_empty() early-return guards in both methods so cleared shmem is treated identically to a missing shmem file. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
7b020da to
f76ea24
Compare
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: f76ea24 | Docs | Datadog PR Page | Give us feedback! |
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.
Summary
expired()clears the shmem file tosize=1, NUL byte. A freshly-started sidecar'sService::new()callspoll_and_apply_rc(), which reads this state and gets an empty data slice.ConfigDirectory::runtime_id()anditer()were failing with"No LF in remote config"instead of treating empty data as "no config available".RemoteConfigManager::fetch_update()already handles this correctly with an explicitif !data.is_empty()guard. This fix mirrors that: addsis_empty()early-return guards in both methods so the cleared shmem state is treated identically to a missing shmem file.size=1, NUL byte) and assertsruntime_id()returns""anditer()returns an empty iterator.Test plan
cargo test --lib rc::testspasses (including newconfig_directory_handles_cleared_shmemtest)RemoteConfigTests.'test shmem cleared by expired and triggers No LF on new worker'now passes without the "No LF" error appearing🤖 Generated with Claude Code