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

runtime error: invalid memory address or nil pointer dereference #88

Closed
mattvb91 opened this issue Jun 22, 2024 · 1 comment · Fixed by #99
Closed

runtime error: invalid memory address or nil pointer dereference #88

mattvb91 opened this issue Jun 22, 2024 · 1 comment · Fixed by #99

Comments

@mattvb91
Copy link

Trying to put together some tests for surrogate caching and cant boot the latest version.

Reproducibly: https://github.com/mattvb91/caddy-cache-surrogates-test

docker compose up

The commit before works: mattvb91/caddy-cache-surrogates-test@817b427

caddy      | {"level":"info","ts":1719079440.4313123,"logger":"http.handlers.cache","msg":"Embedded Olric is ready for this node."}
caddy      | panic: runtime error: invalid memory address or nil pointer dereference
caddy      | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x18262a8]
caddy      | 
caddy      | goroutine 1 [running]:
caddy      | go.uber.org/zap.(*Logger).clone(...)
caddy      |    go.uber.org/zap@v1.27.0/logger.go:318
caddy      | go.uber.org/zap.(*Logger).Sugar(...)
caddy      |    go.uber.org/zap@v1.27.0/logger.go:147
caddy      | github.com/darkweak/souin/pkg/surrogate/providers.(*baseStorage).init(0x40009a80f0, {0x24413c8, 0x40002df230}, {0x1e4639d, 0xe})
caddy      |    github.com/darkweak/souin@v1.6.49/pkg/surrogate/providers/common.go:119 +0x338
caddy      | github.com/darkweak/souin/pkg/surrogate/providers.generateSouinInstance(...)
caddy      |    github.com/darkweak/souin@v1.6.49/pkg/surrogate/providers/souin.go:15
caddy      | github.com/darkweak/souin/pkg/surrogate/providers.SurrogateFactory({0x24413c8, 0x40002df230}, {0x1e4639d, 0xe})
caddy      |    github.com/darkweak/souin@v1.6.49/pkg/surrogate/providers/factory.go:19 +0x1d4
caddy      | github.com/darkweak/souin/pkg/surrogate.InitializeSurrogate(...)
caddy      |    github.com/darkweak/souin@v1.6.49/pkg/surrogate/surrogate.go:82
caddy      | github.com/darkweak/souin/pkg/middleware.NewHTTPCacheHandler({0x24413c8, 0x40002df230})
caddy      |    github.com/darkweak/souin@v1.6.49/pkg/middleware/middleware.go:70 +0x270
caddy      | github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).Provision(0x40002df208, {{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000153be0, 0x2, 0x2}, {0x0, 0x0, ...}, ...})
caddy      |    github.com/caddyserver/cache-handler@v0.13.0/httpcache.go:248 +0x19c
caddy      | github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000153be0, 0x2, 0x2}, {0x0, 0x0, 0x0}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/context.go:369 +0x5f8
caddy      | github.com/caddyserver/caddy/v2.Context.loadModuleInline({{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000522f80, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/context.go:419 +0x12c
caddy      | github.com/caddyserver/caddy/v2.Context.LoadModule({{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000522f80, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/context.go:200 +0x608
caddy      | github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Route).ProvisionHandlers(0x400016f408, {{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000522f80, 0x1, 0x1}, {0x0, 0x0, ...}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/modules/caddyhttp/routes.go:154 +0xbc
caddy      | github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.ProvisionHandlers({0x400016f408, 0x4, 0x0?}, {{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000522f80, 0x1, 0x1}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/modules/caddyhttp/routes.go:209 +0xc8
caddy      | github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision(0x40009d6780, {{0x2431cf8, 0x4000317b30}, 0x400026f260, 0x4000889620, {0x4000522f80, 0x1, 0x1}, {0x0, 0x0, ...}, ...})
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/modules/caddyhttp/app.go:291 +0xb38
caddy      | github.com/caddyserver/caddy/v2.Context.LoadModuleByID({{0x2431d30, 0x4000890f50}, 0x400026f260, 0x4000889620, {0x4000522f80, 0x1, 0x1}, {0x0, 0x0, 0x0}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/context.go:369 +0x5f8
caddy      | github.com/caddyserver/caddy/v2.Context.App({{0x2431d30, 0x4000890f50}, 0x400026f260, 0x4000889620, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/context.go:445 +0x13c
caddy      | github.com/caddyserver/caddy/v2.run.func3(...)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/caddy.go:488
caddy      | github.com/caddyserver/caddy/v2.run(0x40002ea700?, 0x1)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/caddy.go:493 +0x530
caddy      | github.com/caddyserver/caddy/v2.unsyncedDecodeAndRun({0x4000251880, 0x331, 0x380}, 0x1)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/caddy.go:343 +0xe4
caddy      | github.com/caddyserver/caddy/v2.changeConfig({0x1e2ac1b, 0x4}, {0x1e32580, 0x7}, {0x40005ca000, 0x986, 0x987}, {0x0, 0x0}, 0x1)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/caddy.go:234 +0x5c0
caddy      | github.com/caddyserver/caddy/v2.Load({0x40005ca000, 0x986, 0x987}, 0x1)
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/caddy.go:133 +0x198
caddy      | github.com/caddyserver/caddy/v2/cmd.cmdRun({0x0?})
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/cmd/commandfuncs.go:231 +0x61c
caddy      | github.com/caddyserver/caddy/v2/cmd.init.1.func2.WrapCommandFuncForCobra.1(0x40009c4608, {0x1e2ac77?, 0x4?, 0x1e2ac4b?})
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/cmd/cobra.go:137 +0x34
caddy      | github.com/spf13/cobra.(*Command).execute(0x40009c4608, {0x4000824710, 0x1, 0x1})
caddy      |    github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
caddy      | github.com/spf13/cobra.(*Command).ExecuteC(0x3637ea0)
caddy      |    github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
caddy      | github.com/spf13/cobra.(*Command).Execute(...)
caddy      |    github.com/spf13/cobra@v1.8.0/command.go:1039
caddy      | github.com/caddyserver/caddy/v2/cmd.Main()
caddy      |    github.com/caddyserver/caddy/v2@v2.8.4/cmd/main.go:75 +0x180
caddy      | main.main()
caddy      |    caddy/main.go:12 +0x1c
@darkweak
Copy link
Collaborator

Hey @mattvb91 that's weird the logger is nil because it shouldn't as it takes the caddy logger itself. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants