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

Panic on Startup: Nil Pointer Dereference in InfluxDB Client Initialization #214

Closed
cubxxw opened this issue Nov 26, 2023 — with Slack · 4 comments
Closed

Panic on Startup: Nil Pointer Dereference in InfluxDB Client Initialization #214

cubxxw opened this issue Nov 26, 2023 — with Slack · 4 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Milestone

Comments

Copy link
Contributor

cubxxw commented Nov 26, 2023

Description: Encountered a runtime panic during the startup of the OpenKF server component, specifically a nil pointer dereference error in the InfluxDB client initialization.

Steps to Reproduce:

  1. Deployed various services including Milvus, Minio, Redis, MySQL, etcd, and InfluxDB using Docker.
  2. Attempted to start the OpenKF server using Docker Compose.
  3. Observed that the OpenKF server failed to start, encountering a panic during the initialization phase.

Expected Behavior: The OpenKF server should start without errors and begin normal operation.

Actual Behavior: The server crashes immediately after starting, with a panic related to the InfluxDB client.

Environment:

  • OpenKF version: v0.2 (latest)
  • Operating System: Ubuntu (assumed based on command line)
  • Deployment method: Docker/Docker Compose

Logs/Screenshots:

[relevant log information from your provided logs]

Additional Information:

  • MySQL and Redis connections are established successfully, as indicated by logs.
  • The panic occurs specifically in the InitInfluxDB() function, with a nil pointer dereference in net/url.(*URL).ResolveReference.
  • This suggests an issue with the URL used for InfluxDB, possibly being nil or malformed.

Suspected Cause: There might be an issue with how the InfluxDB URL is being parsed or initialized in openkf-server/internal/conn/db/influxdb.go.

Possible Solutions:

  • Verify the InfluxDB URL configuration.
  • Check for any missing environment variables or misconfigurations related to InfluxDB.
  • Review the initialization code for the InfluxDB client in the OpenKF server application.
root@openim-System-Product-Name:/home/openim# docker ps | grep openkf
e11d38948867   milvusdb/milvus:v2.1.4                                                  "/tini -- milvus run…"   22 hours ago   Up 22 hours             0.0.0.0:9091->9091/tcp, :::9091->9091/tcp, 0.0.0.0:19530->19530/tcp, :::19530->19530/tcp   openkf-milvus-standalone
baf8801c1f86   minio/minio:RELEASE.2022-03-17T06-34-49Z                                "/usr/bin/docker-ent…"   22 hours ago   Up 22 hours (healthy)   9000/tcp                                                                                   openkf-milvus-minio
fc47ae3fbdd0   redis:latest                                                            "docker-entrypoint.s…"   22 hours ago   Up 22 hours             0.0.0.0:6479->6379/tcp, :::6479->6379/tcp                                                  openkf-redis
1b25a7a70aba   minio/minio                                                             "/usr/bin/docker-ent…"   22 hours ago   Up 22 hours             0.0.0.0:9100->9000/tcp, :::9100->9000/tcp, 0.0.0.0:9190->9090/tcp, :::9190->9090/tcp       openkf-minio
9a23ecf313f1   mysql:5.7                                                               "docker-entrypoint.s…"   22 hours ago   Up 22 hours             33060/tcp, 0.0.0.0:3406->3306/tcp, :::3406->3306/tcp                                       openkf-mysql
d17ef9d073cd   quay.io/coreos/etcd:v3.5.0                                              "etcd -advertise-cli…"   22 hours ago   Up 22 hours             2379-2380/tcp                                                                              openkf-milvus-etcd
e43b838de89d   influxdb:2.7.1                                                          "/entrypoint.sh infl…"   22 hours ago   Up 22 hours             0.0.0.0:8186->8086/tcp, :::8186->8086/tcp                                                  openkf-influxdb
root@openim-System-Product-Name:/home/openim# ps -ef | grep openkf
root     1044780 1044554  0 17:19 pts/3    00:00:00 grep --color=auto openkf
root@openim-System-Product-Name:/home/openim# ps -ef | grep openkf -a
root     1044967 1044554  0 17:20 pts/3    00:00:00 grep --color=auto openkf -a
root@openim-System-Product-Name:/home/openim# ps -ef | grep openkf ^C
root@openim-System-Product-Name:/home/openim# docker ps -a  | grep openkf
e11d38948867   milvusdb/milvus:v2.1.4                                                  "/tini -- milvus run…"   22 hours ago   Up 22 hours               0.0.0.0:9091->9091/tcp, :::9091->9091/tcp, 0.0.0.0:19530->19530/tcp, :::19530->19530/tcp   openkf-milvus-standalone
baf8801c1f86   minio/minio:RELEASE.2022-03-17T06-34-49Z                                "/usr/bin/docker-ent…"   22 hours ago   Up 22 hours (healthy)     9000/tcp                                                                                   openkf-milvus-minio
fc47ae3fbdd0   redis:latest                                                            "docker-entrypoint.s…"   22 hours ago   Up 22 hours               0.0.0.0:6479->6379/tcp, :::6479->6379/tcp                                                  openkf-redis
1b25a7a70aba   minio/minio                                                             "/usr/bin/docker-ent…"   22 hours ago   Up 22 hours               0.0.0.0:9100->9000/tcp, :::9100->9000/tcp, 0.0.0.0:9190->9090/tcp, :::9190->9090/tcp       openkf-minio
9a23ecf313f1   mysql:5.7                                                               "docker-entrypoint.s…"   22 hours ago   Up 22 hours               33060/tcp, 0.0.0.0:3406->3306/tcp, :::3406->3306/tcp                                       openkf-mysql
d17ef9d073cd   quay.io/coreos/etcd:v3.5.0                                              "etcd -advertise-cli…"   22 hours ago   Up 22 hours               2379-2380/tcp                                                                              openkf-milvus-etcd
e43b838de89d   influxdb:2.7.1                                                          "/entrypoint.sh infl…"   22 hours ago   Up 22 hours               0.0.0.0:8186->8086/tcp, :::8186->8086/tcp                                                  openkf-influxdb
root@openim-System-Product-Name:/home/openim# docker images 
REPOSITORY                                                       TAG                            IMAGE ID       CREATED         SIZE
docker-compose-bot                                               latest                         0edf78a5794b   24 hours ago    8.11GB
docker-compose-web                                               latest                         649953c2d478   42 hours ago    78.3MB
docker-compose-server                                            latest                         a087eb095726   42 hours ago    64.7MB
minio/minio                                                      latest                         88c665b1183a   5 days ago      147MB
grafana/grafana                                                  latest                         06e5d59b720d   5 days ago      399MB
prom/prometheus                                                  latest                         620d5e2a39df   10 days ago     247MB
bitnami/zookeeper                                                3.8                            6679c144167b   10 days ago     516MB
bitnami/kafka                                                    3.5.1                          d8e48edd4e26   11 days ago     558MB
registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-admin-front   v3.4.0                         41ce6ad36ef0   13 days ago     221MB
quay.io/prometheus/node-exporter                                 latest                         72c9c2088986   13 days ago     22.7MB
redis                                                            latest                         961dda256baa   2 weeks ago     138MB
registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-web           latest                         e591ab892062   2 weeks ago     177MB
mysql                                                            5.7                            bdba757bc933   4 weeks ago     501MB
influxdb                                                         2.7.1                          88d9f8f248ba   6 weeks ago     269MB
prom/alertmanager                                                latest                         9f27df16978d   3 months ago    66.8MB
mongo                                                            6.0.2                          b70536aeb250   13 months ago   695MB
milvusdb/milvus                                                  v2.1.4                         d9a5c977c414   14 months ago   711MB
redis                                                            7.0.0                          53aa81e8adfa   18 months ago   117MB
minio/minio                                                      RELEASE.2022-03-17T06-34-49Z   239acc52a73a   20 months ago   228MB
quay.io/coreos/etcd                                              v3.5.0                         a7908fd5fb88   2 years ago     110MB
kindest/node                                                     <none>                         32b8b755dee8   2 years ago     1.12GB
root@openim-System-Product-Name:/home/openim# docker ps -a  | grep server
e33fd09d2733   docker-compose-server                                                   "./docker_init_serve…"   22 hours ago   Exited (2) 22 hours ago                                                                                              docker-compose-server-1
root@openim-System-Product-Name:/home/openim# docker ps -a  | grep^Cerver
root@openim-System-Product-Name:/home/openim# docker logs docker-compose-server
Error response from daemon: No such container: docker-compose-server
root@openim-System-Product-Name:/home/openim# docker logs -f  docker-compose-server 
Error response from daemon: No such container: docker-compose-server
root@openim-System-Product-Name:/home/openim# docker logs -f  docker-compose-server:latest
Error response from daemon: No such container: docker-compose-server:latest
root@openim-System-Product-Name:/home/openim# docker logs -f  docker-compose-server:latestdocker logs^C
root@openim-System-Product-Name:/home/openim# docker logs -f e33fd09d2733
[OpenKF] Load config from ./config.docker.yaml ... Load ok
╭ OpenIM Community ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                              │
│     _______                        ______ ____________                                                                       │
│     __  __ \________ _____ _______ ___  //_/___  ____/                                                                       │
│     _  / / /___  __ \_  _ \__  __ \__  ,<   __  /_                                                                           │
│     / /_/ / __  /_/ //  __/_  / / /_  /| |  _  __/                                                                           │
│     \____/  _  .___/ \___/ /_/ /_/ /_/ |_|  /_/                                                                              │
│             /_/                                                                                                              │
│                                                                                                                              │
│     APP Mode:                                                                                                                │
│     - Version: 0.1.0-dev                                                                                                     │
│     - Debug: true                                                                                                            │
│     - Log file: logs/                                                                                                        │
│                                                                                                                              │
│     Github repo: https://github.com/openimsdk/openkf.                                                                        │
│     Official website: https://www.openim.online/en                                                                           │
│     OpenKF Slack: https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg (OpenKF clannels)     │
│     🎉🎉 Welcome to your contribution :)                                                                                     │
│                                                                                                                              │
│     Copyright © 2023 OpenIM open source community. All rights reserved.                                                      │
│     Licensed under the Apache License (the "License");                                                                       │
│                                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2023-11-25 11:08:24.642 [INFO] [FilePath:conn/db/mysql.go:109] [Operation:Mysql] connect ok root:123123@tcp(177.8.0.3:3306)/openkf?charset=utf8mb4&parseTime=True&loc=Local
2023-11-25 11:08:24.647 [INFO] [FilePath:cmd/dbmigration/main.go:75] [Operation:OpenKF Table Migration] Migrate table systemroles.SysUser... ok
2023-11-25 11:08:24.649 [INFO] [FilePath:cmd/dbmigration/main.go:75] [Operation:OpenKF Table Migration] Migrate table systemroles.SysCustomer... ok
2023-11-25 11:08:24.649 [INFO] [FilePath:cmd/dbmigration/main.go:75] [Operation:OpenKF Table Migration] Migrate table systemroles.SysCommunity... ok
2023-11-25 11:08:24.651 [INFO] [FilePath:cmd/dbmigration/main.go:75] [Operation:OpenKF Table Migration] Migrate table systemroles.SysBot... ok
2023-11-25 11:08:24.652 [INFO] [FilePath:cmd/dbmigration/main.go:75] [Operation:OpenKF Table Migration] Migrate table customerroles.CustomerSlack... ok
RegisterHook Register Hook[CORS] success...
RegisterHook Register Hook[JWT] success...
RegisterHook Register Hook[RATE] success...
RegisterHook Register Hook[GlobalHook] success...
RegisterHook Register Hook[MailHook] success...
[OpenKF] Load config from ./config.docker.yaml ... Load ok
╭ OpenIM Community ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                              │
│     _______                        ______ ____________                                                                       │
│     __  __ \________ _____ _______ ___  //_/___  ____/                                                                       │
│     _  / / /___  __ \_  _ \__  __ \__  ,<   __  /_                                                                           │
│     / /_/ / __  /_/ //  __/_  / / /_  /| |  _  __/                                                                           │
│     \____/  _  .___/ \___/ /_/ /_/ /_/ |_|  /_/                                                                              │
│             /_/                                                                                                              │
│                                                                                                                              │
│     APP Mode:                                                                                                                │
│     - Version: 0.1.0-dev                                                                                                     │
│     - Debug: true                                                                                                            │
│     - Log file: logs/                                                                                                        │
│                                                                                                                              │
│     Github repo: https://github.com/openimsdk/openkf.                                                                        │
│     Official website: https://www.openim.online/en                                                                           │
│     OpenKF Slack: https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg (OpenKF clannels)     │
│     🎉🎉 Welcome to your contribution :)                                                                                     │
│                                                                                                                              │
│     Copyright © 2023 OpenIM open source community. All rights reserved.                                                      │
│     Licensed under the Apache License (the "License");                                                                       │
│                                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2023-11-25 11:08:24.662 [INFO] [FilePath:conn/db/mysql.go:109] [Operation:Mysql] connect ok root:123123@tcp(177.8.0.3:3306)/openkf?charset=utf8mb4&parseTime=True&loc=Local
2023-11-25 11:08:24.663 [INFO] [FilePath:conn/db/redis.go:278] [Operation:Redis] connect ping response: PONG
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5b0d63]

goroutine 1 [running]:
net/url.(*URL).ResolveReference(0x0, 0xc000135440)
        /usr/local/go/src/net/url/url.go:1085 +0x83
net/url.(*URL).Parse(0xc00059a680?, {0x1164461?, 0x6?})
        /usr/local/go/src/net/url/url.go:1073 +0x47
github.com/influxdata/influxdb-client-go/v2/internal/write.NewService({0xc00003bca0, 0x6}, {0xc00003bcc0, 0x6}, {0x13340b0?, 0xc0003e8f50}, 0xc00059ef50)
        /go/pkg/mod/github.com/influxdata/influxdb-client-go/[email protected]/internal/write/service.go:77 +0xba
github.com/influxdata/influxdb-client-go/v2/api.NewWriteAPIBlocking(...)
        /go/pkg/mod/github.com/influxdata/influxdb-client-go/[email protected]/api/writeAPIBlocking.go:63
github.com/influxdata/influxdb-client-go/v2.(*clientImpl).WriteAPIBlocking(0xc0005fc600, {0xc00003bca0, 0x6}, {0xc00003bcc0, 0x6})
        /go/pkg/mod/github.com/influxdata/influxdb-client-go/[email protected]/client.go:239 +0x17a
github.com/openimsdk/openkf/server/internal/conn/db.InitInfluxDB()
        /openkf-server/internal/conn/db/influxdb.go:55 +0x223
main.init.0()
        /openkf-server/main.go:43 +0xde
@cubxxw cubxxw added the kind/bug Categorizes issue or PR as related to a bug. label Nov 26, 2023 — with Slack
@cubxxw cubxxw added this to the v0.3 milestone Nov 26, 2023 — with Slack
@IRONICBo IRONICBo self-assigned this Nov 26, 2023
@IRONICBo
Copy link
Collaborator

I will update it these days.

@cubxxw
Copy link
Contributor Author

cubxxw commented Nov 27, 2023

I will update it these days.

good

@kubbot
Copy link
Member

kubbot commented Jan 27, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@kubbot kubbot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 27, 2024
@kubbot
Copy link
Member

kubbot commented Feb 3, 2024

This issue was closed because it has been stalled for 7 days with no activity.

@kubbot kubbot closed this as completed Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

3 participants