Skip to content

ENT-14695: Record events promise outcome - #6383

Open
victormlg wants to merge 3 commits into
cfengine:masterfrom
victormlg:cf-reactor.RecordPromiseOutcome
Open

victormlg wants to merge 3 commits into
cfengine:masterfrom
victormlg:cf-reactor.RecordPromiseOutcome

Conversation

@victormlg

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread cf-reactor/file_watcher.c Outdated
{
char *path;
time_t last_seen; /* Time the file was last observed present, 0 if absent */
bool lstat_failing; /* Whether the last lstat() failed, to log a failure only once */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Won't the event only be triggered once? Or is it being re-triggered repeatedly? It should probably only be triggered once on the actual event of deleting it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function FileDeleted is running continuously inside WatcherThreadMain. So if it has an error, it would spam the error output. This flag was to prevent that.

I changed it now to print the error every LSTAT_ERROR_LOG_INTERVAL_SECS instead

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But should not the event only be triggered once? If it fails to fix it, then the agent will hopefully fix it later?

@victormlg victormlg Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileDeleted is run continuously to detect events. If it fails for whatever reason, then the watcher thread will push a single event that it failed. As long as it (the thread) receives the failure, it will not push any event until the error is fixed.

Then, when handling the event, the evaluator sees that the event has an error, and instead of runnnig the "then" bundle, it will return early, and record the outcome of the promise as FAILED

@victormlg
victormlg force-pushed the cf-reactor.RecordPromiseOutcome branch 2 times, most recently from 43a6fea to bd51630 Compare October 9, 2026 12:48
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Ticket: ENT-14695
Logs errors every minute instead of on every poll

Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg
victormlg force-pushed the cf-reactor.RecordPromiseOutcome branch from bd51630 to fd591bb Compare October 9, 2026 13:06
@victormlg
victormlg requested a review from larsewi October 9, 2026 14:09
@victormlg

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins, please :)

@cf-bottom

Copy link
Copy Markdown

@victormlg

Copy link
Copy Markdown
Contributor Author

Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants