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

Resolved Issue 1661 - AIX Runtime Panic in Host #1663

Merged
merged 11 commits into from
Jun 14, 2024

Conversation

aidangill-projects
Copy link
Contributor

Resolved an issue on AIX where a software panic was caused at 0 minutes on the hour when uptime was called.

When uptime is called at 00 minutes it shows as this:

08:47PM up 2 days, 20 hrs, 1 user, load average: 2.47, 2.17, 2.17

At 20:21 it shows as this:

08:47PM up 2 days, 20:21, 1 user, load average: 2.47, 2.17, 2.17

I've added logic to parse this new case, code now passes all given examples (tried to add some tests, not sure how you want to mock the command line use, would be happy to add with an example).

@shirou
Copy link
Owner

shirou commented Jun 7, 2024

The PR seem good to me. However, given the variety of output results, could you separate the parse part into a different function and make it testable? Something like func parseUptime(in string) (unit64, error) could be considered. This function would take the output string of uptime as an argument and return the total_time.

@aidangill-projects
Copy link
Contributor Author

I've done that + added tests.. it returns zero on error at the moment as before, let me know if you want any changes

@aidangill-projects
Copy link
Contributor Author

aidangill-projects commented Jun 7, 2024

Hey mate might need to check this, bit of a noob at Go to be honest, the numbers in those tests were incorrect but seemed like they were passing, updated to be correct - also the test suite here in github doesn't seem to check AIX, might need updating

@aidangill-projects
Copy link
Contributor Author

Found another case of failure - added to code / tests:

01:16AM up 4 days, 29 mins, 1 user, load average: 2.29, 2.31, 2.21

This command line tool is pretty inconsistent huh

@shirou
Copy link
Owner

shirou commented Jun 7, 2024

Does the uptime command of AIX has some option like -s? At least my Linux has the option and the output seems stable.

% uptime -s
2024-06-03 01:42:58

@aidangill-projects
Copy link
Contributor Author

aidangill-projects commented Jun 7, 2024

It's very rudimentary and does not I'm afraid, not the best platform, I've gone through the options and this is all it gives - I will be able to test this thoroughly though and update with any further issues if any however, I've got a script running every minute at the moment

@aidangill-projects
Copy link
Contributor Author

Hey mate let me know what you want me to do with this one, worth noting it doesn't just effect the uptime call, it effects the whole host library on AIX as other calls also request uptime 👍

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Are there any more changes? If not, I would like to merge it. Thank you for your contribution!

@aidangill-projects
Copy link
Contributor Author

Nothing more I can see, if I find anything I'll be back 🤣

@Dylan-M
Copy link

Dylan-M commented Jun 10, 2024

This will need cherry picked to the 3.x maintenance bugfix releases too, if you can please.

Thank you @aidangill-projects for the additions on this. I thought I caught all of the variations on the formats when I wrote this, but obviously not.

@Dylan-M
Copy link

Dylan-M commented Jun 10, 2024

Fixes #1661

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Thank you for contributing. It seems fine, so I would like to merge it. If any issues arise, please create a new PR.

However, we are not considering backporting this change to v3. This is because we do not have the manpower to maintain multiple versions. Unless there is a security issue, we do not plan to update v3.

@shirou shirou merged commit 47f1604 into shirou:master Jun 14, 2024
23 checks passed
@aidangill-projects aidangill-projects deleted the issue-1661 branch June 15, 2024 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants