artefactual-sdps / enduro

Designed to automate the processing of transfers in multiple Archivematica pipelines.
https://enduro.readthedocs.io/
Apache License 2.0
4 stars 3 forks source link

Problem: the API logs report recovered panics #944

Closed jraddaoui closed 1 month ago

jraddaoui commented 1 month ago

Describe the bug

Reported by @scollazo in Slack:


May 02 10:26:13 sfa-dev EnduroStdout[1362751]: 2024-05-02T10:26:13.782Z        V(2)        enduro        api/middleware.go:48        Panic error recovered.        {"error": "panic: runtime error: invalid memory address or nil pointer dereference\npanic({0x1de3160?, 0x39cb530?})\n\truntime/panic.go:770 +0x132\ngithub.com/artefactual-sdps/enduro/internal/package_.(*goaWrapper).Monitor(0xc0006b8840, {0x2866500, 0xc00079f180}, 0xc0006b9080, {0x2857308, 0xc00079f220})\n\tgithub.com/artefactual-sdps/enduro/internal/package_/goa.go:83 +0xcb\ngithub.com/artefactual-sdps/enduro/internal/api/gen/package_.NewEndpoints.NewMonitorEndpoint.func2({0x2866500?, 0xc00079f180?}, {0x1ca1ba0?, 0xc0005e0408?})\n\tgithub.com/artefactual-sdps/enduro/internal/api/gen/package_/endpoints.go:105 +0x54\ngithub.com/artefactual-sdps/enduro/internal/api/gen/http/package_/server.NewMonitorHandler.func1({0x2862f70, 0xc0005d4d20}, 0xc0005d1320)\n\tgithub.com/artefactual-sdps/enduro/internal/api/gen/http/package_/server/server.go:241 +0x338\nnet/http.HandlerFunc.ServeHTTP(0xc00083d020?, {0x2862f70?, 0xc0005d4d20?}, 0xe?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/artefactual-sdps/enduro/internal/api/gen/http/package_/server.HandlePackageOrigin.func1({0x2862f70, 0xc0005d4d20}, 0xc0005d1320)\n\tgithub.com/artefactual-sdps/enduro/internal/api/gen/http/package_/server/server.go:660 +0x447\nnet/http.HandlerFunc.ServeHTTP(0xc000117880?, {0x2862f70?, 0xc0005d4d20?}, 0xc0000bebe0?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/artefactual-sdps/enduro/internal/api/gen/http/package_/server.MountMonitorHandler.WithRouteTag.func2({0x2862f70, 0xc0005d4d20}, 0xc0005d1320)\n\tgo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.49.0/handler.go:281 +0x21a\nnet/http.HandlerFunc.ServeHTTP(0xc000989200?, {0x2862f70?, 0xc0005d4d20?}, 0x0?)\n\tnet/http/server.go:2166 +0x29\nnet/http.HandlerFunc.ServeHTTP(0xc0007e81e0?, {0x2862f70?, 0xc0005d4d20?}, 0xc000844bc4?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc00011b620, {0x2862f70, 0xc0005d4d20}, 0xc0005d1320)\n\tgithub.com/go-chi/chi/v5@v5.0.12/mux.go:459 +0x2e6\nnet/http.HandlerFunc.ServeHTTP(0x28664c8?, {0x2862f70?, 0xc0005d4d20?}, 0x39cc5a0?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc00011b620, {0x2862f70, 0xc0005d4d20}, 0xc0005d1200)\n\tgithub.com/go-chi/chi/v5@v5.0.12/mux.go:90 +0x2ee\ngithub.com/artefactual-sdps/enduro/internal/api.HTTPServer.HTTPServer.recoverMiddleware.func7.func8({0x2862f70?, 0xc0005d4d20?}, 0x283e301?)\n\tgithub.com/artefactual-sdps/enduro/internal/api/middleware.go:56 +0xa2\nnet/http.HandlerFunc.ServeHTTP(0x28664c8?, {0x2862f70?, 0xc0005d4d20?}, 0x283e398?)\n\tnet/http/server.go:2166 +0x29\ngo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*middleware).serveHTTP(0xc0006a04e0, {0x2861bc0, 0xc0001b1ea0}, 0xc0005d10e0, {0x2846840, 0xc0005c3950})\n\tgo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.49.0/handler.go:225 +0x1243\ngo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.NewMiddleware.func1.1({0x2861bc0?, 0xc0001b1ea0?}, 0x21447bb?)\n\tgo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.49.0/handler.go:83 +0x35\nnet/http.HandlerFunc.ServeHTTP(0xc0005d33e0?, {0x2861bc0?, 0xc0001b1ea0?}, 0x283e36c?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/artefactual-sdps/enduro/internal/api.HTTPServer.HTTPServer.versionHeaderMiddleware.func10.func11({0x2861bc0, 0xc0001b1ea0}, 0xc0005d10e0)\n\tgithub.com/artefactual-sdps/enduro/internal/api/middleware.go:65 +0x8c\nnet/http.HandlerFunc.ServeHTTP(0x471999?, {0x2861bc0?, 0xc0001b1ea0?}, 0xc0005eeb68?)\n\tnet/http/server.go:2166 +0x29\nnet/http.serverHandler.ServeHTTP({0xc0005d3350?}, {0x2861bc0?, 0xc0001b1ea0?}, 0x6?)\n\tnet/http/server.go:3137 +0x8e\nnet/http.(*conn).serve(0xc0005b9d40, {0x28664c8, 0xc00053f080})\n\tnet/http/server.go:2039 +0x5e8\ncreated by net/http.(*Server).Serve in goroutine 49\n\tnet/http/server.go:3285 +0x4b4\n\n"}

To Reproduce

Hit the API /monitor endpoint with authentication disabled.

@sevein took a look and it seems to be happening here.

Expected behavior

The monitor endpoint works with authentication disabled.