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

Allow opting out of udev usage via GlobalConfig #2562

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Allow opting out of udev usage via GlobalConfig #2562

merged 1 commit into from
Jan 11, 2024

Conversation

chadlwilson
Copy link
Contributor

As discussed in #2561 (comment) adds a configuration option oshi.os.linux.allowudev (default: true) to actively disable use of udev to load more detailed device information.

  • If we'd prefer to invert the property to be _disabled instead, I can do that too.
  • Solaris allowKstat2 uses a type of camel case format. I can follow that, but other properties don't use that (logwarning, commandline etc) so bit unsure which format to follow.
  • I didn't add a specific test as it'd need a VM fork for the test due to the use of static (or some bytecode/classloader magic)

Validated that this does work for the specific use case in the discussion:

After

jvm 1    | 2024-01-11 12:50:14,683 INFO  [main] AgentStatusHttpd:66 - Agent status HTTP API server running on http://localhost:8152.
jvm 1    | 2024-01-11 12:50:16,428 WARN  [main] LinuxOperatingSystem:92 - Loading of udev not allowed by configuration. Some features may not work.
jvm 1    | 2024-01-11 12:50:16,830 INFO  [main] ThreadPoolTaskScheduler:166 - Initializing ExecutorService 'scheduler'
...

Before (in my somewhat broken frankenstein Alpine / glibc environment)

jvm 1    | 2024-01-11 12:51:59,916 INFO  [main] AgentStatusHttpd:66 - Agent status HTTP API server running on http://localhost:8152.
jvm 1    | #
jvm 1    | # A fatal error has been detected by the Java Runtime Environment:
...

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM, I'll tweak that log message and merge.

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e3ac471) 86.57% compared to head (169c09c) 86.57%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2562   +/-   ##
=======================================
  Coverage   86.57%   86.57%           
=======================================
  Files          30       30           
  Lines        1311     1311           
  Branches      183      183           
=======================================
  Hits         1135     1135           
  Misses         97       97           
  Partials       79       79           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Chad Wilson <chadw@thoughtworks.com>
@dbwiddis dbwiddis merged commit e535000 into oshi:master Jan 11, 2024
15 checks passed
@chadlwilson chadlwilson deleted the optional-udev branch January 11, 2024 22:48
@chadlwilson
Copy link
Contributor Author

Thanks so much, really appreciate the interaction, response and release! All working perfectly for GoCD

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.

None yet

2 participants