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

Handles a wait_for_connection call right after a task caused a shutdown #710

Merged
merged 1 commit into from
May 8, 2020

Conversation

s1113950
Copy link
Collaborator

@s1113950 s1113950 commented Apr 17, 2020

Fixes #655

wait_for_connection in Ansible calls both a connection.reset() as well as an _execute_module.

In the case of issue 655, a shutdown call right before the wait_for_connection caused Mitogen to disconnect from the host and then be stuck in a bad state when _execute_module was called.

wait_for_connection is set up to retry continually to connect, which was masking errors that Mitogen was throwing when it couldn't set up a connection.

To fix I forced Mitogen to reconnect if the ping module is used with wait_for_connection and made sure that if we're trying to create a Pool that we have a router.

@s1113950
Copy link
Collaborator Author

/aside to travis: oh travis! Please report results!

@s1113950
Copy link
Collaborator Author

Travis does not seem to wanna launch a test 🤦

@s1113950
Copy link
Collaborator Author

New plan:
don't use docker-machine since it seems to not work well with add_host (no docker sock file). Wonder if it's possible to install docker for mac via terminal only. Could also figure out how to connect docker-machine with an add_host-ed docker container setup.

@s1113950
Copy link
Collaborator Author

s1113950 commented May 1, 2020

@cognifloyd can you review this one as well? :) 🙏

@s1113950
Copy link
Collaborator Author

s1113950 commented May 1, 2020

ooh I'll squash commits into 1 actually since there's no current chat history

Copy link
Contributor

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

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

I don't understand all of the code involved (I haven't been able to grok all of the innards of mitogen so far), but from what I can tell, this looks reasonable.
Just one question about the test playbook.

# since things are ran on localhost; Azure DevOps loses connection and fails
# TODO: do we want to install docker a different way to be able to do this for other tests too
---
# this should only run on our Mac hosts
Copy link
Contributor

Choose a reason for hiding this comment

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

What prevents this from running on non-mac hosts? I don't see any safety checks to bail if the host is not a mac, instead it will just go up in smoke when the dmg can't be unpacked, or the /Volumes directory doesn't exist.

Copy link
Collaborator Author

@s1113950 s1113950 May 1, 2020

Choose a reason for hiding this comment

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

The target host only runs on our Mac setup because Mac is the only test that runs localhost_ansible tests (see azure-pipelines.yml). Technically someone could run it themselves on a non-mac and it might not work but the tests are really set up for running through CI mostly so I didn't worry about that. I left a note so that if we end up running localhost_ansible on another host then we'd know to refactor this file a bit. It's not super clear though; if you'd like I could edit the comment to reflect something different!

Copy link
Contributor

@cognifloyd cognifloyd May 7, 2020

Choose a reason for hiding this comment

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

Nah. The comment as-is is enough. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good!

@luto
Copy link

luto commented May 6, 2020

fixes the reboot module as well. Thank you!

@s1113950 s1113950 merged commit 74b7934 into mitogen-hq:master May 8, 2020
@s1113950 s1113950 deleted the issue655 branch May 8, 2020 15:14
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.

wait_for_connection gives errors
3 participants