[go: up one dir, main page]

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

Improvements to Starnix VM handling #5334

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

eepeep
Copy link
Collaborator
@eepeep eepeep commented Sep 23, 2024

No description provided.

@eepeep eepeep requested a review from glpesk September 23, 2024 22:45
This allows for multiple starnix VM pools to exist simultaneously
without conflict, and avoids any unintential global state.
- Extraneous references to the `ffx log` pipe are closed, allowing the
  EOF from the subprocess to be propagated properly.
- The SSH bridge into the Starnix sshd is now properly shut down when
  the instance is closed, avoiding a zombie process.
- Some of the starnix code has been updated to be in line with a
  refactor that took place in other VM types.
They are very noisy and can cause important crash information to run off
the end of the buffer; this is a temporary fix to avoid that.
if err != nil {
return nil, fmt.Errorf("failed to make ffx isolation dir: %w", err)
}
log.Logf(0, "initialized vm pool with ffx dir: %v", ffxDir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: how about putting this under an if env.Debug? (I do sometimes refer to this log string in order to run ffx log on the side, but it would be okay to have it only in debug mode.)

@@ -137,6 +161,12 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
return inst, nil
}

func (pool *Pool) Close() error {
log.Logf(0, "shutting down vm pool with tempdir %v...", pool.ffxDir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Likewise, maybe print this only in debug mode.

if err != nil {
return nil, err
}
inst.sshPrivKey = string(bytes.Trim(privkey, "\"\n"))

// Copy auto-detected product bundle path from in-tree ffx to isolated ffx.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea, glad this worked!

@@ -187,8 +215,9 @@ func (inst *instance) Close() error {
}

func (inst *instance) startFuchsiaVM() error {
err := inst.ffx("emu", "start", "--headless", "--name", inst.name, "--net", "user")
if err != nil {
inst.runFfx(1*time.Minute, "config", "get", "product.path")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: any reason the timeout is different from the same command in pool.Create()?

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.

2 participants