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

fly console fails if vm.memory is set in fly.toml without vm.cpu_kind and vm.cpus #4107

Closed
lesliebc opened this issue Dec 4, 2024 · 5 comments · Fixed by #4112
Closed

fly console fails if vm.memory is set in fly.toml without vm.cpu_kind and vm.cpus #4107

lesliebc opened this issue Dec 4, 2024 · 5 comments · Fixed by #4112
Labels
bug Something isn't working

Comments

@lesliebc
Copy link

lesliebc commented Dec 4, 2024

Describe the bug
fly console spits out "Oops, something went wrong! Could you try that again?" if:

  • vm.memory is set alone in fly.toml, or
  • vm.memory is set with vm.size only

This can be worked around by adding vm.cpu_kind and vm.cpus.

  • fly version
    fly v0.3.46 darwin/arm64 Commit: 65df111 BuildDate: 2024-12-04T14:43:36Z
    (also observed in releases since at least v0.3.42)

** Paste your fly.toml

app = 'myapp'
primary_region = 'ewr'
console_command = '/rails/bin/rails console'

# omitted other sections for brevity

[[vm]]
  memory = "2gb"
  size = "shared-cpu-4x"

** Command output: **

% fly console
Oops, something went wrong! Could you try that again?

runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:26 +0x64
github.com/superfly/flyctl/internal/sentry.printError({0x10478de40, 0x105e43ed0})
        github.com/superfly/flyctl/internal/sentry/sentry.go:190 +0x168
github.com/superfly/flyctl/internal/sentry.Recover({0x10478de40, 0x105e43ed0})
        github.com/superfly/flyctl/internal/sentry/sentry.go:180 +0xb8
main.run.func1()
        github.com/superfly/flyctl/main.go:40 +0x34
panic({0x10478de40?, 0x105e43ed0?})
        runtime/panic.go:785 +0x124
github.com/superfly/flyctl/internal/command/console.determineEphemeralConsoleMachineGuest({0x104b371a8, 0x14000939bf0}, 0x10402e747?)
        github.com/superfly/flyctl/internal/command/console/console.go:414 +0xb0
github.com/superfly/flyctl/internal/command/console.selectMachine({0x104b371a8, 0x14000939bf0}, 0x140006683f8, 0x140000b6b60)
        github.com/superfly/flyctl/internal/command/console/console.go:246 +0x68
github.com/superfly/flyctl/internal/command/console.runConsole({0x104b371a8, 0x14000666270})
        github.com/superfly/flyctl/internal/command/console/console.go:204 +0x378
github.com/superfly/flyctl/internal/command/console.New.New.newRunE.func1(0x140005f7808, {0x105efd0a0?, 0x4?, 0x104021416?})
        github.com/superfly/flyctl/internal/command/command.go:140 +0x188
github.com/spf13/cobra.(*Command).execute(0x140005f7808, {0x105efd0a0, 0x0, 0x0})
        github.com/spf13/cobra@v1.8.1/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x14000032308)
        github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/superfly/flyctl/internal/cli.Run({0x104b37330?, 0x14000576900?}, 0x140006957c0, {0x140001dc070, 0x1, 0x1})
        github.com/superfly/flyctl/internal/cli/cli.go:94 +0x5a0
main.run()
        github.com/superfly/flyctl/main.go:47 +0x174
main.main()
        github.com/superfly/flyctl/main.go:26 +0x20
@lesliebc lesliebc added the bug Something isn't working label Dec 4, 2024
@knksmith57
Copy link

knksmith57 commented Dec 6, 2024

This bit us today. Thanks for providing a workaround, @lesliebc.

Here's what we had before (that worked fine) but now crashes fly console:

[[vm]]
  size = 'shared-cpu-2x'
  memory = '1gb'

And here's the workaround after adding vm.cpus and vm.cpu_kind:

[[vm]]
  size = 'shared-cpu-2x'
  memory = '1gb'
  cpus = 2
  cpu_kind = 'shared'

Per the docs, all of these keys should be optional, so this is definitely broken in the current release and not user error.

I wonder if this breakage is at all related to @jipperinbham's work to remove the global GraphQL API call dependency from configuration normalization 🤔

@dangra
Copy link
Member

dangra commented Dec 6, 2024

Hi guys, this bug was introduced in #4073. It is not related to the GraphQL work.

A fix will be released soon #4112.

Thanks for the report and workaround comments!

@knksmith57
Copy link

I'm on 0.3.50 and this is still a problem:

❯ fly version
fly v0.3.50 darwin/arm64 Commit: a9c2fb39a36edbff834da9d35704dd351203461b BuildDate: 2024-12-12T17:06:06Z
❯ fly console --select
Error: invalid CPU kind ''; valid values are 'shared' and 'performance'
❯ fly config show | jq .vm
[
  {
    "size": "shared-cpu-2x",
    "memory": "1gb"
  }
]

@knksmith57
Copy link

Cross-linking to #4049 for visibility

@dangra
Copy link
Member

dangra commented Dec 16, 2024

@knksmith57 you are right. I focused on fixing the panic and forgot to look at the original bug. Will try to craft a fix but can't promise it for this week 🏖️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants