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

Invert state and listening logic #18738

Closed
wants to merge 1 commit into from
Closed

Conversation

baude
Copy link
Member

@baude baude commented May 30, 2023

When waiting for a VM to boot up, we check for two indicators to before mounting volumes: is the vm "running" and is the qemu socket listening. In some cases, presumably race or system pressure, it is possible that the qemu socket may be listening but the vm (and specifically sshd) is not running yet.

Fixes: #17403

[NO NEW TESTS NEEDED]

Does this PR introduce a user-facing change?

none

When waiting for a VM to boot up, we check for two indicators to before mounting volumes: is the vm "running" and is the qemu socket listening.  In some cases, presumably race or system pressure, it is possible that the qemu socket may be listening but the vm (and specifically sshd) is not running yet.

Fixes: containers#17403

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
@openshift-ci openshift-ci bot added release-note-none approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 30, 2023
@baude
Copy link
Member Author

baude commented May 30, 2023

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 30, 2023
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM
@containers/podman-maintainers PTAL

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99
Copy link
Member

Luap99 commented Jun 13, 2023

@baude Why is this is on hold? I would like to wait until @baude confirms this is good to go.

@benoitf
Copy link
Contributor

benoitf commented Jun 13, 2023

FYI this PR is not solving on my side the issue #17403
This is why I think @baude put on hold after trying on my computer
It does not mean it can't solve problems but it's not solving the issue

@@ -661,7 +661,7 @@ func (v *MachineVM) Start(name string, opts machine.StartOptions) error {
return err
}
listening := v.isListening()
for state != machine.Running || !listening {
Copy link
Member

Choose a reason for hiding this comment

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

Tried this out. Every time I've been able to reproduce this error, listening after line 633 is true, which means that usually this condition isn't met and the loop is never used, even on failures.

@vrothberg
Copy link
Member

LGTM, I still think this is worth merging as it fixes the condition.

@Luap99 WDYT?

@Luap99
Copy link
Member

Luap99 commented Jul 4, 2023

Actually rethinking here, no that does not seem correct.

What we want is to wait for the VM to be running and listening, the for loop will continue until the condition is false.

Thus we need a condition that is false only if both conditions are true, so
!(state == machine.Running && listening) which is the same as state != machine.Running || !listening so the current code seems correct.

The bigger problem I see here is that we can potentially loop forever because there is no time-out.

@vrothberg
Copy link
Member

Thus we need a condition that is false only if both conditions are true, so
!(state == machine.Running && listening) which is the same as state != machine.Running || !listening so the current code seems correct.

Has been a while since I used this boolean transformation but you are absolutely right. Hard to believe when reading the condition out loud.

@vrothberg vrothberg closed this Jul 4, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Oct 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Podman machine fails to start with exit status 255 on Mac
5 participants