Skip to content

fix(helper-rust): treat cleared shmem as no-config rather than error#3876

Open
cataphract wants to merge 1 commit into
masterfrom
bob/fix-rc-cleared-shmem
Open

fix(helper-rust): treat cleared shmem as no-config rather than error#3876
cataphract wants to merge 1 commit into
masterfrom
bob/fix-rc-cleared-shmem

Conversation

@cataphract
Copy link
Copy Markdown
Contributor

Summary

  • When the sidecar's last runtime disconnects, expired() clears the shmem file to size=1, NUL byte. A freshly-started sidecar's Service::new() calls poll_and_apply_rc(), which reads this state and gets an empty data slice. ConfigDirectory::runtime_id() and iter() were failing 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. This fix mirrors that: adds is_empty() early-return guards in both methods so the cleared shmem state is treated identically to a missing shmem file.
  • Adds a unit test that writes a cleared-state shmem file (size=1, NUL byte) and asserts runtime_id() returns "" and iter() returns an empty iterator.

Test plan

  • cargo test --lib rc::tests passes (including new config_directory_handles_cleared_shmem test)
  • Integration test 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

@cataphract cataphract requested a review from a team as a code owner May 12, 2026 11:12
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>
@cataphract cataphract force-pushed the bob/fix-rc-cleared-shmem branch from 7b020da to f76ea24 Compare May 12, 2026 11:14
@datadog-prod-us1-3
Copy link
Copy Markdown

datadog-prod-us1-3 Bot commented May 12, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.66% (-0.06%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f76ea24 | Docs | Datadog PR Page | Give us feedback!

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.

1 participant