ENT-3868: Improve persistent class logging#6159
Closed
nickanderson wants to merge 2 commits into
Closed
Conversation
existing_info was allocated via xcalloc but never freed on the early-return (preserve) path, the early-return (read error) path, or the normal fall-through path. Signed-off-by: Nick Anderson <nick.anderson@northern.tech>
Replace the generic "Updating persistent class" verbose message with context-aware messages that distinguish between: - Creating a new persistent class (no prior DB record) - Resetting a timer (existing record, policy=reset) - Updating a preserved class (tags changed or class expired) This makes it easier to diagnose persistent class timer behavior from verbose logs without needing to add custom debugging builds. Ticket: ENT-3868 Changelog: Title
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
existing_infoinEvalContextHeapPersistentSave(missingfree()on the fall-through and early-return paths)"Updating persistent class '%s'"log message with context-aware messages that distinguish between:This helps diagnose timer_policy behavior from verbose logs, which was the remaining gap identified in ENT-3868.
Before
After
Changelog
Commit 1: Fix memory leak
existing_infowas allocated viaxcallocbut never freed on the fall-through path (after the PRESERVE early-return check) or on the error early-return path. Addedfree(existing_info)in all code paths.Commit 2: Improve logging
Moved logging into the branches where the existing/new state is already known, replacing the single generic message with descriptive alternatives.
Test plan
persistence => "10"on a classes promise, runcf-agent -Kvtwice — first run should log "Creating", second should log "Resetting"timer_policy => "absolute"in a classes body on a files promise, run twice — should log "Creating" then "already in a preserved state"Ticket
ENT-3868