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

Handle errors gracefully in DAPR dashboard server 0.15.0 #279

Open
MisterFreeze opened this issue Nov 13, 2024 · 1 comment
Open

Handle errors gracefully in DAPR dashboard server 0.15.0 #279

MisterFreeze opened this issue Nov 13, 2024 · 1 comment
Labels

Comments

@MisterFreeze
Copy link

MisterFreeze commented Nov 13, 2024

DAPR dashboard server handles errors gracefully

With an invalid API call do the DAPR dashboard API, the API serving process logs an error messsage, returns a 4XX or 5XX error reflecting the cause of the failure, and keeps its ability to serve requests.

DAPR dashboard server crashes

With a fresh DAPR install on a kubernetes cluster, and no dapr applications deployed, an attempt to access the dapr-dashboard via kubectl port-forwarding was made. When connecting to the local port with a web browser, the dapr-dashboard process crashes. Full error message below

Dapr Dashboard running on http://localhost:8080
panic: runtime error: index out of range [0] with length 0

goroutine 45 [running]:
github.com/dapr/dashboard/pkg/instances.(*instances).GetControlPlaneStatus.func1({0x2006bda,0x15})
    /home/runner/work/dashboard/dashboard/pkg/instances/instances.go:464+0x7a6
created by github.com/dapr/dashboard/pkg/instances.(*instances).GetControlPlaneStatus in goroutine 49
    /home/runner/work/dashboard/dashboard/pkg/instances/instances.go:446 +0xba

Steps to Reproduce the Problem

initialize dapr on a kubernetes cluster, with dapr dashboard 0.15.0

user@host:~/some/path$ dapr init -k

connect to the dapr-dashboard via kubectl proxy

user@host:~/some/path$ kubectl port-forward 'dapr-dashboard-<ID>' 8888:8080 --namespace 'dapr-system'

open a web browser and point it to http://localhost:8888

Release Note

RELEASE NOTE: FIX handle errors in control panel status when a dapr pod is not yet ready

@MisterFreeze
Copy link
Author

Digging a little bit deeper, it seems not all dapr services' pods were ready (see below), which potentially leads to the ContainerStatuses[0] to not be a valid element. Though this is not the "happy" situation, expectation would be to check an array length before accessing it and not crash the server.

https://github.com/dapr/dashboard/blob/master/pkg/instances/instances.go#L464

kubectl get pods --namespace dapr-system 
NAME                                     READY   STATUS    RESTARTS       AGE
dapr-dashboard-6d7744b449-2zx9r          1/1     Running   14 (86m ago)   3h38m
dapr-operator-5bb4bbcbc-jvsp4            1/1     Running   0              3h38m
dapr-placement-server-0                  1/1     Running   0              3h38m
dapr-scheduler-server-0                  0/1     Pending   0              3h38m
dapr-sentry-759fffd946-8s9zw             1/1     Running   0              3h38m
dapr-sidecar-injector-74579cbcbb-tp7b5   1/1     Running   0              3h38m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant