apisix dashboard - docker - panic: runtime error: invalid memory address or nil pointer dereference
Issue description
using docker compose to run apisix dashboard (latest). Likely there is an error in the yaml file but it should not panic? Apisix (part also of the docker compose works fine)
Expected behavior
a different error message
How to Reproduce
- docker compose up
- see the logs(panic when it starts)
Screenshots
apisix-dashboard | panic: runtime error: invalid memory address or nil pointer dereference
apisix-dashboard | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xca1ef3]
apisix-dashboard |
apisix-dashboard | goroutine 1 [running]:
apisix-dashboard | github.com/apisix/manager-api/internal/core/storage.InitETCDClient(0xc0004cfc80?)
apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/storage/etcd.go:59 +0x53
apisix-dashboard | github.com/apisix/manager-api/internal/core/server.(*server).setupStore(0x60?)
apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/server/store.go:27 +0x25
apisix-dashboard | github.com/apisix/manager-api/internal/core/server.(*server).init(0xc000056401?)
apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/server/server.go:89 +0x52
apisix-dashboard | github.com/apisix/manager-api/internal/core/server.(*server).Start(0xc0004bbc20, 0xc000515c80)
apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/server/server.go:49 +0x27
apisix-dashboard | github.com/apisix/manager-api/cmd.manageAPI()
apisix-dashboard | /usr/local/apisix-dashboard/api/cmd/root.go:71 +0x91
apisix-dashboard | github.com/apisix/manager-api/cmd.glob..func1(0x17b3960?, {0xf8045b?, 0x0?, 0x0?})
apisix-dashboard | /usr/local/apisix-dashboard/api/cmd/root.go:40 +0x17
apisix-dashboard | github.com/spf13/cobra.(*Command).execute(0x17b3960, {0xc000034240, 0x0, 0x0})
apisix-dashboard | /go/pkg/mod/github.com/spf13/[email protected]/command.go:916 +0x862
apisix-dashboard | github.com/spf13/cobra.(*Command).ExecuteC(0x17b3960)
apisix-dashboard | /go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x3bd
apisix-dashboard | github.com/spf13/cobra.(*Command).Execute(...)
apisix-dashboard | /go/pkg/mod/github.com/spf13/[email protected]/command.go:968
apisix-dashboard | github.com/apisix/manager-api/cmd.Execute()
apisix-dashboard | /usr/local/apisix-dashboard/api/cmd/root.go:55 +0x25
apisix-dashboard | main.main()
apisix-dashboard | /usr/local/apisix-dashboard/api/main.go:24 +0x17
Environment
latest docker version on ubuntu
Additional context
extract docker compose .yaml
apisix-dash:
image: apache/apisix-dashboard
depends_on:
- apisix
- etcd
container_name: apisix-dashboard
ports:
- "9721:9000/tcp"
volumes:
# - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
# - ../all-in-one/apisix-dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro
- ./apisix_conf/apisix-dashboard.yml:/usr/local/apisix-dashboard/conf/conf.yaml:ro
networks:
apisix:
conf file:
conf:
listen:
host: 0.0.0.0 # `manager api` listening ip or host name
port: 9000 # `manager api` listening port
etcd:
host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
- "http://etcd:2379" # multiple etcd address
prefix: "/apisix" # apisix configurations prefix
timeout: 30 # 30 seconds
# etcd basic auth info
# username: "root" # ignore etcd username if not enable etcd auth
# password: "123456" # ignore etcd password if not enable etcd auth
log:
error_log:
level: warn # supports levels, lower to higher: debug, info, warn, error, panic, fatal
file_path:
logs/error.log # supports relative path, absolute path, standard output
# such as: logs/error.log, /tmp/logs/error.log, /dev/stdout, /dev/stderr
authentication:
secret:
secret # secret for jwt token generation.
# NOTE: Highly recommended to modify this value to protect `manager api`.
# if it's default value, when `manager api` start, it will generate a random string to replace it.
expire_time: 3600 # jwt token expire time, in second
users:
- username: admin # username and password for login `manager api`
password: admin
- username: user
password: user
plugin_attr:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091
I was able to fix it if (not sure which one was needed):
- I renamed host to endpoints
- I removed
timeout: 30 - I removed the block
plugin_attr
Hope it helps to handle the panic case.
Getting this error for ubuntu based setup ,
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xca1ef3]
goroutine 1 [running]: github.com/apisix/manager-api/internal/core/storage.InitETCDClient(0xc00064cc80?) /usr/local/apisix-dashboard/api/internal/core/storage/etcd.go:59 +0x53 github.com/apisix/manager-api/internal/core/server.(*server).setupStore(0x60?) /usr/local/apisix-dashboard/api/internal/core/server/store.go:27 +0x25 github.com/apisix/manager-api/internal/core/server.(*server).init(0xc000080001?) /usr/local/apisix-dashboard/api/internal/core/server/server.go:89 +0x52 github.com/apisix/manager-api/internal/core/server.(*server).Start(0xc000637fe0, 0xc000480180) /usr/local/apisix-dashboard/api/internal/core/server/server.go:49 +0x27 github.com/apisix/manager-api/cmd.manageAPI() /usr/local/apisix-dashboard/api/cmd/root.go:71 +0x91 github.com/apisix/manager-api/cmd.glob..func1(0x17b3960?, {0xf8045b?, 0x0?, 0x0?}) /usr/local/apisix-dashboard/api/cmd/root.go:40 +0x17 github.com/spf13/cobra.(*Command).execute(0x17b3960, {0xc000034240, 0x0, 0x0}) /go/pkg/mod/github.com/spf13/[email protected]/command.go:916 +0x862 github.com/spf13/cobra.(*Command).ExecuteC(0x17b3960) /go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x3bd github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/[email protected]/command.go:968 github.com/apisix/manager-api/cmd.Execute() /usr/local/apisix-dashboard/api/cmd/root.go:55 +0x25 main.main() /usr/local/apisix-dashboard/api/main.go:24 +0x17 root@nd-dev-platform-apisix-common:~#
I did not succeed, is there a solution?
the docker image of the dashboard didn't saw any updates since 2 years.
Hi, we will release a new dashboard to address legacy issues. Refer to https://github.com/apache/apisix-dashboard/issues/2981
I was able to fix it if (not sure which one was needed):
- I renamed host to endpoints
- I removed
timeout: 30- I removed the block
plugin_attrHope it helps to handle the panic case.
just tested, U have to rename host to endpoints.
Getting the issue in 3.0.1-alpine and 3.0.1-centos
apisix-dashboard | goroutine 1 [running]: apisix-dashboard | github.com/apisix/manager-api/internal/core/storage.InitETCDClient(0xc0005f7130?) apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/storage/etcd.go:59 +0x53 apisix-dashboard | github.com/apisix/manager-api/internal/core/server.(*server).setupStore(0x60?) apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/server/store.go:27 +0x25 apisix-dashboard | github.com/apisix/manager-api/internal/core/server.(*server).init(0xc000054401?) apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/server/server.go:89 +0x52 apisix-dashboard | github.com/apisix/manager-api/internal/core/server.(*server).Start(0xc0005fa270, 0xc000073a40) apisix-dashboard | /usr/local/apisix-dashboard/api/internal/core/server/server.go:49 +0x27 apisix-dashboard | github.com/apisix/manager-api/cmd.manageAPI() apisix-dashboard | /usr/local/apisix-dashboard/api/cmd/root.go:71 +0x91 apisix-dashboard | github.com/apisix/manager-api/cmd.glob..func1(0x17b3960?, {0xf8045b?, 0x0?, 0x0?}) apisix-dashboard | /usr/local/apisix-dashboard/api/cmd/root.go:40 +0x17 apisix-dashboard | github.com/spf13/cobra.(*Command).execute(0x17b3960, {0xc00008c200, 0x0, 0x0}) apisix-dashboard | /go/pkg/mod/github.com/spf13/[email protected]/command.go:916 +0x862 apisix-dashboard | github.com/spf13/cobra.(*Command).ExecuteC(0x17b3960) apisix-dashboard | /go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x3bd apisix-dashboard | github.com/spf13/cobra.(*Command).Execute(...) apisix-dashboard | /go/pkg/mod/github.com/spf13/[email protected]/command.go:968 apisix-dashboard | github.com/apisix/manager-api/cmd.Execute() apisix-dashboard | /usr/local/apisix-dashboard/api/cmd/root.go:55 +0x25 apisix-dashboard | main.main() apisix-dashboard | /usr/local/apisix-dashboard/api/main.go:24 +0x17 apisix-dashboard exited with code 2
dashboard/conf.yaml conf: listen: host: 0.0.0.0 port: 9000
etcd: endpoints: - "http://etcd1:2379" prefix: "/apisix"
authentication: secret: "secret_!23" expire_time: 3600 users:
- username: "admin" password: "admin"
docker-compose.yml
services: apisix: image: apache/apisix:3.14.1-ubuntu restart: always volumes: - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro depends_on: - etcd1 ports: - "9180:9180/tcp" - "9080:9080/tcp" - "9091:9091/tcp" - "9443:9443/tcp" - "9092:9092/tcp" networks: apisix:
etcd1: image: gcr.io/etcd-development/etcd:v3.5.24 environment: - ALLOW_NONE_AUTHENTICATION=yes - ETCD_DATA_DIR=/etcd-data - ETCD_ADVERTISE_CLIENT_URLS=http://etcd1:2379 - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 - ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 - ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd1:2380 - ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380 volumes: - ./etcd_data/etcd1:/etcd-data networks: - apisix ports: - "2379:2379/tcp"
apisix-dashboard: image: apache/apisix-dashboard:3.0.1-centos container_name: apisix-dashboard restart: unless-stopped depends_on: - apisix - etcd1 networks: - apisix ports: - "9000:9000" volumes: - ./dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro networks: apisix: driver: bridge
volumes: etcd_data: driver: local