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

apisix dashboard - docker - panic: runtime error: invalid memory address or nil pointer dereference #2946

Open
shuther opened this issue May 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@shuther
Copy link

shuther commented May 29, 2024

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

  1. docker compose up
  2. 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
@shuther shuther added the bug Something isn't working label May 29, 2024
@shuther
Copy link
Author

shuther commented May 29, 2024

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.

@nd-serviceaccount
Copy link

Getting this error for ubuntu based setup ,

@nd-serviceaccount
Copy link

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:~#

@heroesf
Copy link

heroesf commented Oct 16, 2024

I did not succeed, is there a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants