Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spam log messages about sticky faults on Spark #1

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

szinck
Copy link

@szinck szinck commented Feb 6, 2025

The code looks like it's intended to only cause a log message if the state of sticky faults changes in some way.

getStickyFaults() retuns a new java object each time, so using == for comparison on the object will always return true.

This change looks at the rawBits of the fault object instead.

old behavior = log message once a second even if there are no sticky faults
new behavior = log message only when the bits actually change

It might arguably be better to log once a second but only when there are faults so that the presence of faults is easier to see in a busy log file (but this doesn't do that). If the code is changed in that way, this class could have a lot of code removed.

The code looks like it's intended to only cause a log message if the state of
sticky faults changes in some way.

getStickyFaults() retuns a new java object each time, so using == for
comparison on the object will always return true.

This change looks at the rawBits of the fault object instead.

old behavior = log message once a second even if there are no sticky faults
new behavior = log message only when the bits actually change

It might arguably be better to log once a second but only when there are faults
so that the presence of faults is easier to see in a busy log file.
@viggy96
Copy link
Contributor

viggy96 commented Feb 6, 2025

That's a great catch!

In that case, the if statement should probably check the following:
if (faults.rawBits != 0)

And then we also don't need to store the previous fault state in the hashmap.

@viggy96
Copy link
Contributor

viggy96 commented Feb 6, 2025

Logging Spark warnings in the SparkMonitor in a similar fashion might prove useful as well.

@szinck
Copy link
Author

szinck commented Feb 6, 2025

I updated the PR to compare if rawBits=0 and removed the tracking of previous state as you suggested.

@viggy96 viggy96 merged commit bb23404 into lasarobotics:master Feb 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants