acorn-io / runtime

A simple application deployment framework built on Kubernetes
https://docs.acorn.io/
Apache License 2.0
1.13k stars 100 forks source link

`acorn login` for nested acorns fails with "invalid memory address or nil pointer dereference" #2446

Closed sangee2004 closed 10 months ago

sangee2004 commented 10 months ago

acorn version - v0.10.0-rc5+e2b69a6d

Steps to reproduce the problem:

  1. Deploy app from https://github.com/acorn-io/mongodb-external/tree/main/examples.

  2. When user is prompted to enter credentials , creating a new credential/choosing an existing one results in panic:

....
mytestmongconsume
STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] 
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] waiting for quota allocation; (container: app): pending; (service: db): pending
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] (container: app): waiting for service to be created [db], waiting for service to be ready [db]; (service: db): pending
STATUS: ENDPOINTS[https://mytestmongconsume-9e3706e5.8w80e0.on-acorn.io] HEALTHY[0] UPTODATE[0] (container: app): waiting for service to be created [db], waiting for service to be ready [db]; (service: db): acorn [mytestmongconsume.db] is not ready
? Choose an existing credential or enter a new one Existing: config-pgl8j (Keys: [address, adminPassword, adminUsername, dbName, password, port, proto, username], Created: [2024-01-20 07:50:48 -0800 PST])
? Choose an existing credential or enter a new one Existing: config-pgl8j (Keys: [address, adminPassword, adminUsername, dbName, password, port, proto, username], Created: [2024-01-20 07:50:48 -0800 PST])
? Credential [mytestmongconsume.db.config] is configured to [config-pgl8j], do you want to change it No
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x698 pc=0x10529dd90]

goroutine 155 [running]:
github.com/acorn-io/runtime/pkg/login.Secrets({0x1069952d0, 0x14001300140}, {0x1069f8b28, 0x1400055c960}, 0x140012ce800)
    github.com/acorn-io/runtime/pkg/login/login.go:28 +0x120
github.com/acorn-io/runtime/pkg/login.loginApp({0x1069952d0, 0x14001300140}, {0x1069f8b28?, 0x1400055c960?}, {0x1400128e5a0?, 0x14000e91830?})
    github.com/acorn-io/runtime/pkg/login/login.go:55 +0xa4
github.com/acorn-io/runtime/pkg/login.Secrets({0x1069952d0, 0x14001300140}, {0x1069f8b28, 0x1400055c960}, 0x1400113c000)
    github.com/acorn-io/runtime/pkg/login/login.go:38 +0x240
github.com/acorn-io/runtime/pkg/login.loginApp({0x1069952d0, 0x14001300140}, {0x1069f8b28?, 0x1400055c960?}, {0x14000d44c78?, 0x140017ac7a0?})
    github.com/acorn-io/runtime/pkg/login/login.go:55 +0xa4
github.com/acorn-io/runtime/pkg/login.Secrets({0x1069952d0, 0x14001300140}, {0x1069f8b28, 0x1400055c960}, 0x14000f80000)
    github.com/acorn-io/runtime/pkg/login/login.go:38 +0x240
github.com/acorn-io/runtime/pkg/login.loginApp({0x1069952d0, 0x14001300140}, {0x1069f8b28?, 0x1400055c960?}, {0x14000ddaf90?, 0x102?})
    github.com/acorn-io/runtime/pkg/login/login.go:55 +0xa4
github.com/acorn-io/runtime/pkg/login.Secrets({0x1069952d0, 0x14001300140}, {0x1069f8b28, 0x1400055c960}, 0x14000e57000)
    github.com/acorn-io/runtime/pkg/login/login.go:38 +0x240
github.com/acorn-io/runtime/pkg/log.(*DefaultLoggerImpl).AppStatus(0x140012f0100, 0x14?, {0x14000a3c750, 0x88}, 0x14001979701?)
    github.com/acorn-io/runtime/pkg/log/default_log.go:50 +0xf4
github.com/acorn-io/runtime/pkg/dev.PrintAppStatus(0x14000a3c6c0?, {0x10695a800, 0x140012f0100})
    github.com/acorn-io/runtime/pkg/dev/dev.go:528 +0x54
github.com/acorn-io/runtime/pkg/dev.AppStatusLoop.func1(0x14000e57000)
    github.com/acorn-io/runtime/pkg/dev/dev.go:543 +0x1e8
github.com/acorn-io/baaah/pkg/watcher.retryWatch[...].func1()
    github.com/acorn-io/baaah@v0.0.0-20240119160309-2a58ee757bbd/pkg/watcher/watcher.go:104 +0x48
github.com/acorn-io/baaah/pkg/watcher.doWatch[...]({0x1069952d0, 0x14001300140}, {0x14000ea6a90, 0x1069c8e38?}, 0x102b9e9c4?, 0x14000fe1ae8?)
    github.com/acorn-io/baaah@v0.0.0-20240119160309-2a58ee757bbd/pkg/watcher/watcher.go:78 +0x3e4
github.com/acorn-io/baaah/pkg/watcher.retryWatch[...]({0x1069952d0, 0x14001300140}, {0x14000ea6a90, 0x140002b40e0?}, 0x14000822280?, 0x140019e0b78?)
    github.com/acorn-io/baaah@v0.0.0-20240119160309-2a58ee757bbd/pkg/watcher/watcher.go:108 +0xac
github.com/acorn-io/baaah/pkg/watcher.(*Watcher[...]).bySelector(0x1069c07a0, {0x1069952d0, 0x14001300140?}, {0x140002c4c26, 0x5}, {0x0, 0x0?}, {0x1069a36a8, 0x140016b0020?}, 0x140010da1e0)
    github.com/acorn-io/baaah@v0.0.0-20240119160309-2a58ee757bbd/pkg/watcher/watcher.go:209 +0x314
github.com/acorn-io/baaah/pkg/watcher.(*Watcher[...]).ByName(0x1069c07a0?, {0x1069952d0, 0x14001300140}, {0x140002c4c26, 0x5}, {0x14000f25860, 0x11}, 0x14000e066f8)
    github.com/acorn-io/baaah@v0.0.0-20240119160309-2a58ee757bbd/pkg/watcher/watcher.go:168 +0x2b8
github.com/acorn-io/runtime/pkg/dev.AppStatusLoop({0x1069952d0, 0x14001300140}, {0x1069f8b28, 0x1400055c960}, {0x10695a800?, 0x140012f0100}, {0x14000f25860, 0x11})
    github.com/acorn-io/runtime/pkg/dev/dev.go:538 +0x188
github.com/acorn-io/runtime/pkg/wait.App.func1()
    github.com/acorn-io/runtime/pkg/wait/wait.go:29 +0x138
created by github.com/acorn-io/runtime/pkg/wait.App in goroutine 1
    github.com/acorn-io/runtime/pkg/wait/wait.go:27 +0x194
sangee2004 commented 10 months ago

This issue is fixed by - https://github.com/acorn-io/runtime/pull/2445

sangee2004 commented 10 months ago

Tested with acorn version -acorn version v0.10.0-1-g07b2490c+07b2490c

  1. Able to deploy app from https://github.com/acorn-io/mongodb-external/tree/main/examples successfully.
mytestexternalnew
STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] 
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] (container: app): waiting for service to be created [db], waiting for service to be ready [db]; (service: db): pending
STATUS: ENDPOINTS[http://app-mytestexternalnew-68651d25.local.oss-acorn.io] HEALTHY[0] UPTODATE[0] (container: app): waiting for service to be created [db], waiting for service to be ready [db]; (service: db): acorn [mytestexternalnew.db] is not ready
? Choose an existing credential or enter a new one Existing: config-mkgnw (Keys: [address, adminPassword, adminUsername, dbName, password, port, proto, username], Created: [2024-01-20 08:38:07 -0800 PST])
? Choose an existing credential or enter a new one Existing: config-mkgnw (Keys: [address, adminPassword, adminUsername, dbName, password, port, proto, username], Created: [2024-01-20 08:38:07 -0800 PST])
? Credential [mytestexternalnew.db.config] is configured to [config-mkgnw], do you want to change it No
STATUS: ENDPOINTS[http://app-mytestexternalnew-68651d25.local.oss-acorn.io] HEALTHY[0] UPTODATE[0] "acorn login mytestexternalnew" required

┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐
| STATUS: ENDPOINTS[http://app-mytestexternalnew-68651d25.local.oss-acorn.io] HEALTHY[1] UPTODATE[1] OK |

No panics seen.