flyteorg / flyte

Scalable and flexible workflow orchestration platform that seamlessly unifies data, ML and analytics stacks.
https://flyte.org
Apache License 2.0
5.76k stars 657 forks source link

[BUG] [flytectl] segfault when config file is missing #2506

Open wild-endeavor opened 2 years ago

wild-endeavor commented 2 years ago

Describe the bug

flytectl segfaults apparently when the config file is missing. User reported when creating and listing projects. Issue went away when we created a sandbox style config.yaml in the .flyte directory.

INFO[0000] [0] Couldn't find a config file []. Relying on env vars and pflags. 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xfef5a3]
ā€‹
goroutine 1 [running]:
github.com/flyteorg/flytectl/cmd/core.CommandContext.AdminClient(...)
        /home/runner/work/flytectl/flytectl/cmd/core/cmd_ctx.go:48
github.com/flyteorg/flytectl/cmd/create.createProjectsCommand({0x23461e8, 0xc000050110}, {0x1ffffffffffffff?, 0x39?, 0x8?}, {0x0, {0x0, 0x0}, {0x0, 0x0}, ...})
        /home/runner/work/flytectl/flytectl/cmd/create/project.go:62 +0xe3
github.com/flyteorg/flytectl/cmd/core.generateCommandFunc.func1(0xc000454c80?, {0xc00027e800, 0x0, 0x8})
        /home/runner/work/flytectl/flytectl/cmd/core/cmd.go:65 +0x625
github.com/spf13/cobra.(*Command).execute(0xc000454c80, {0xc00027e780, 0x8, 0x8})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc00055b900)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x39c
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
github.com/flyteorg/flytectl/cmd.ExecuteCmd()
        /home/runner/work/flytectl/flytectl/cmd/root.go:134 +0x1e
main.main()
        /home/runner/work/flytectl/flytectl/main.go:12 +0x1d
{
 "App": "flytectl",
 "Build": "c06589e",
 "Version": "0.5.25",
 "BuildTime": "2022-05-17 18:15:50.341414608 -0400 EDT m=+0.024193929"
}{
 "App": "controlPlane",
 "Build": "072ce74",
 "Version": "v1.1.2",
 "BuildTime": "2022-05-16 16:49:17.16516979 +0000 UTC m=+0.185367550"
}

Expected behavior

A nice error message telling the user to run config init maybe?

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

Have you read the Code of Conduct?

wild-endeavor commented 2 years ago

Note that while I saw this happen in real-time in the user's terminal, we are unable to repro this locally. Locally we get

$ flytectl get project
INFO[0000] [0] Couldn't find a config file []. Relying on env vars and pflags.
{"json":{},"level":"error","msg":"failed to initialize token source provider. Err: failed to fetch auth metadata. Error: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: missing address\"","ts":"2022-05-17T15:30:02-07:00"}
{"json":{},"level":"warning","msg":"Starting an unauthenticated client because: can't create authenticated channel without a TokenSourceProvider","ts":"2022-05-17T15:30:02-07:00"}
{"json":{},"level":"info","msg":"Initialized Admin client","ts":"2022-05-17T15:30:02-07:00"}
Error: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: missing address"
{"json":{},"level":"error","msg":"rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: missing address\"","ts":"2022-05-17T15:30:02-07:00"}
baldurfb commented 2 years ago

I'm encountering the same issue. Running "flytectl config init" solved the first problem; but is there a workaround for the connection issue?

baldurfb commented 2 years ago

I solved the connection issue by creating a local sandbox. You can stick more helpful/descriptive error messages on the backlog ;)

github-actions[bot] commented 1 year ago

Hello šŸ‘‹, This issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! šŸ™

github-actions[bot] commented 1 year ago

Hello šŸ‘‹, This issue has been inactive for over 9 months and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! šŸ™

kumare3 commented 10 months ago

we should make the UX better for flytectl

github-actions[bot] commented 1 month ago

Hello šŸ‘‹, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable. Thank you for your contribution and understanding! šŸ™