tedsmitt / ecsgo

Provides an interactive prompt to connect to ECS Containers using the ECS ExecuteCommand API.
Apache License 2.0
81 stars 13 forks source link

Nil pointer #46

Closed dpengftw closed 2 weeks ago

dpengftw commented 5 months ago

My guess is that the API calls are reaching a rate limit, therefore the code is running into nil pointer.

Solution would be to use a backoff function to call AWS api, if the first call fails.

`> ecsgo ? Select a task: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102fdafac]

goroutine 18 [running]: github.com/tedsmitt/ecsgo/internal.getPlatformFamily({0x103619a00, 0x1400011a100}, {0x1034115e0?, 0x140004ded80?}, 0x140004c8900) github.com/tedsmitt/ecsgo/internal/internal.go:87 +0x8c github.com/tedsmitt/ecsgo/internal.(App).getContainerOS(0x140004016b0) github.com/tedsmitt/ecsgo/internal/app.go:426 +0xa0 github.com/tedsmitt/ecsgo/internal.(App).getTask(0x140004016b0) github.com/tedsmitt/ecsgo/internal/app.go:366 +0xb8c github.com/tedsmitt/ecsgo/internal.(App).Start.func1() github.com/tedsmitt/ecsgo/internal/app.go:70 +0x130 created by github.com/tedsmitt/ecsgo/internal.(App).Start github.com/tedsmitt/ecsgo/internal/app.go:60 +0x84`

dpengftw commented 4 months ago

Forgot to mention that this is with ECS with EC2 backend.

tedsmitt commented 3 weeks ago

@dpengftw can you try upgrading to the latest version and trying this again? A back off was added to the sdk v2 config - not had chance to test it yet though

dpengftw commented 2 weeks ago

Ok, looks like that did the trick:

`

ecsgo --version ecsgo version Version: 0.6.1, Commit: c29e18f985c4bbc6e813ed77e79672fa0ef0185f, Built date: 2024-10-15T19:23:45Z, Built by: goreleaser

Starting session with SessionId: ecs-execute-command-9ybux6aajbhjarulxttbossnv8 sh-4.2# date Sun Oct 20 01:26:03 UTC 2024 sh-4.2# exit`