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

Fix /health REST API panic #763

Merged
merged 3 commits into from
Sep 21, 2023
Merged

Fix /health REST API panic #763

merged 3 commits into from
Sep 21, 2023

Conversation

chaitanyaprem
Copy link
Collaborator

@chaitanyaprem chaitanyaprem commented Sep 21, 2023

Description

Noticed following panic when triggering health API without rln initialization.

2023/09/21 16:34:48 "GET http://127.0.0.1:8645/health HTTP/1.1" from 127.0.0.1:61835 - 000 0B in 56.458µs
2023/09/21 16:34:48 http: panic serving 127.0.0.1:61835: runtime error: invalid memory address or nil pointer dereference
goroutine 761 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1854 +0xb0
panic({0x106fe0a60, 0x107c8cf30})
	/usr/local/go/src/runtime/panic.go:890 +0x258
github.com/waku-org/go-waku/cmd/waku/server/rest.(*HealthService).getHealth(0x14001289890?, {0x1300b05e0, 0x14001114cc0}, 0x7?)
	/Users/prem/Code/go-waku/cmd/waku/server/rest/health.go:33 +0x50
net/http.HandlerFunc.ServeHTTP(0x106fd1700?, {0x1300b05e0?, 0x14001114cc0?}, 0x1400165d33c?)
	/usr/local/go/src/net/http/server.go:2122 +0x38
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0x1400055f8c0, {0x1300b05e0, 0x14001114cc0}, 0x140010e7600)
	/Users/prem/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.0/mux.go:436 +0x218
net/http.HandlerFunc.ServeHTTP(0x140004718c8?, {0x1300b05e0?, 0x14001114cc0?}, 0x7?)
	/usr/local/go/src/net/http/server.go:2122 +0x38
github.com/go-chi/chi/v5/middleware.NoCache.func1({0x1300b05e0, 0x14001114cc0}, 0x140010e7600)
	/Users/prem/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.0/middleware/nocache.go:54 +0x228
net/http.HandlerFunc.ServeHTTP(0x140010e7500?, {0x1300b05e0?, 0x14001114cc0?}, 0x10447cc18?)
	/usr/local/go/src/net/http/server.go:2122 +0x38
github.com/go-chi/chi/v5/middleware.RequestLogger.func1.1({0x10721a5a0, 0x14000a3e620}, 0x140010e7500)
	/Users/prem/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.0/middleware/logger.go:57 +0x120
net/http.HandlerFunc.ServeHTTP(0x10721be90?, {0x10721a5a0?, 0x14000a3e620?}, 0x107c8c440?)
	/usr/local/go/src/net/http/server.go:2122 +0x38
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0x1400055f8c0, {0x10721a5a0, 0x14000a3e620}, 0x140010e7400)
	/Users/prem/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.0/mux.go:87 +0x2e4
net/http.serverHandler.ServeHTTP({0x14000920090?}, {0x10721a5a0, 0x14000a3e620}, 0x140010e7400)
	/usr/local/go/src/net/http/server.go:2936 +0x2d8
net/http.(*conn).serve(0x14000984870, {0x10721bf38, 0x14000690150})
	/usr/local/go/src/net/http/server.go:1995 +0x560
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3089 +0x520

Changes

  • Fix panic in health REST API endpoint if rln is not initialized/compiled
  • Update REST API yml files title. cc @NagyZoltanPeter , this has to be done across all files.

Tests

@status-im-auto
Copy link

status-im-auto commented Sep 21, 2023

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ae88615 #1 2023-09-21 11:35:01 ~2 min nix-flake 📄log
✔️ ae88615 #1 2023-09-21 11:35:26 ~2 min linux 📦deb
✔️ ae88615 #1 2023-09-21 11:35:51 ~3 min tests 📄log
✔️ ae88615 #1 2023-09-21 11:36:07 ~3 min tests 📄log
✔️ ae88615 #1 2023-09-21 11:36:57 ~4 min ios 📦tgz
✔️ ae88615 #1 2023-09-21 11:37:00 ~4 min android 📦tgz
✔️ b1bb5d4 #2 2023-09-21 11:36:42 ~1 min linux 📦deb
✔️ b1bb5d4 #2 2023-09-21 11:36:59 ~1 min nix-flake 📄log
✔️ b1bb5d4 #2 2023-09-21 11:37:11 ~3 min ios 📦tgz
✔️ b1bb5d4 #2 2023-09-21 11:37:29 ~1 min tests 📄log
✔️ b1bb5d4 #2 2023-09-21 11:38:18 ~2 min tests 📄log
✔️ b1bb5d4 #2 2023-09-21 11:40:44 ~3 min android 📦tgz

@chaitanyaprem chaitanyaprem merged commit 3254d28 into master Sep 21, 2023
11 checks passed
@chaitanyaprem chaitanyaprem deleted the fix-rest-api-panic branch September 21, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants