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 error while fetching mysql pid from psutil #1620

Merged
merged 6 commits into from
May 31, 2018
Merged

Fix error while fetching mysql pid from psutil #1620

merged 6 commits into from
May 31, 2018

Conversation

masci
Copy link
Contributor

@masci masci commented May 28, 2018

What does this PR do?

Improves the logic we use to see if the server is running, currently broken as in #1325

Motivation

#1325, thanks @steffenweber for reporting

Review checklist

  • PR has a meaningful title or PR has the no-changelog label attached
  • Feature or bugfix has tests
  • Git history is clean
  • If PR impacts documentation, docs team has been notified or an issue has been opened on the documentation repo

Additional Notes

A test was added to check fix behaviour and prevent regressions

gmmeyer
gmmeyer previously approved these changes May 29, 2018
Copy link
Collaborator

@nmuesch nmuesch left a comment

Choose a reason for hiding this comment

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

Just a small comment/question, but looks good 💯

except Exception:
self.log.exception("Error while fetching mysql pid from psutil")
except (psutil.AccessDenied, psutil.ZombieProcess, psutil.NoSuchProcess):
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we debug log the exception here to help if we run into issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure it'd help, if the codepath gets there it means a process died during the iteration. If that process was exactly mysql, the pid would be None anyways so in terms of responsibilities of the function we're good. If that wasn't mysql, we don't care at all.

Copy link
Contributor

@gmmeyer gmmeyer left a comment

Choose a reason for hiding this comment

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

this looks great! thank you for doing all of this to the tests.

time.sleep(2)

return connected
MYSQL_FLAVOR = os.getenv('MYSQL_FLAVOR', 'mysql')
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not have the version here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's used only once so I thought it didn't deserve to be a module-global

@masci masci merged commit 88fc95f into master May 31, 2018
@masci masci deleted the massi/mysql branch May 31, 2018 06:29
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