Skip to content

fix(input.temp): Ignore EAGAIN on unavailable thermal-zones#18913

Open
01110111000001 wants to merge 1 commit into
influxdata:masterfrom
01110111000001:fix/temp-ignore-eagain
Open

fix(input.temp): Ignore EAGAIN on unavailable thermal-zones#18913
01110111000001 wants to merge 1 commit into
influxdata:masterfrom
01110111000001:fix/temp-ignore-eagain

Conversation

@01110111000001
Copy link
Copy Markdown

@01110111000001 01110111000001 commented May 13, 2026

Summary

When the hardware device is sleeping, the temp input plugin completely hangs waiting for the os.ReadFile call to return.
The EAGAIN returned by the kernel is handled internally by os.ReadFile and the function waits for the file to become available.
-> Open the file in non-blocking mode and silently ignoring unavailable thermal-zones.

Some comments/potential issues

  1. It seems to me the EAGAIN could also happen on hwmon files but I do not have a device that exhibits this behavior. Should I call the new readFileAsync function for the hwmons too?
  2. I fear some metrics from zones could be ignored when an EAGAIN is returned for another reason (like the kernel being busy but the hardware being available, if it could even happen?)
  3. the silent dropping causes the number of metrics gathered to not be predictible as some thermal-zones might be present but not available and thus dropped. Should a default value be returned instead of dropping the metrics ? If so, what should be the default value? User defined in the config?

Looking forward to your feedback and your thoughts on the potential issues.
Thanks for your great work on this tool!

Checklist

AI was used to generate a first version (heavily modified since) of the newly added unit test for the readFileAsync function.

Related issues

resolves #18899

@telegraf-tiger telegraf-tiger Bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels May 13, 2026
@01110111000001 01110111000001 marked this pull request as draft May 13, 2026 22:38
@01110111000001 01110111000001 force-pushed the fix/temp-ignore-eagain branch from 5ff01fc to fd277f6 Compare May 13, 2026 22:51
@01110111000001 01110111000001 marked this pull request as ready for review May 13, 2026 22:53
@01110111000001
Copy link
Copy Markdown
Author

The integration tests failed at plugins/outputs/graphite/graphite_test.go:636, not sure why as I did not touch that file and the test does not seem to rely on the inputs.temp plugin.
I may be wrong though.

Tell me if should do anything to correct that!

@srebhan srebhan changed the title fix(input.temp): silently ignore EAGAIN on unavailable thermal-zones fix(input.temp): Ignore EAGAIN on unavailable thermal-zones May 19, 2026
Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @01110111000001! Just one question about the content length...

Comment thread plugins/inputs/temp/temp_linux.go
@srebhan srebhan self-assigned this May 19, 2026
@01110111000001 01110111000001 force-pushed the fix/temp-ignore-eagain branch from fd277f6 to 57729fe Compare May 20, 2026 09:09
@telegraf-tiger
Copy link
Copy Markdown
Contributor

@01110111000001
Copy link
Copy Markdown
Author

@srebhan I rebased my branch on top of the new master branch state so the comparison shows many changes.

I modified the comment to be more descriptive as well as the test case to clearly show only the first 8 bytes are read.

Thanks for your reviews!

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

Labels

area/system fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[inputs.temp] support gathering both hwmon and thermal zones at the same time + don't block on "Resource temporarily unavailable" files

2 participants