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

DATA RACE in Souin #576

Open
christophcemper opened this issue Nov 14, 2024 · 5 comments · May be fixed by #578
Open

DATA RACE in Souin #576

christophcemper opened this issue Nov 14, 2024 · 5 comments · May be fixed by #578

Comments

@christophcemper
Copy link

We keep getting DATA RACE conditions (or total crashes and outages that require manual restarts in the middle of the night)
and besides other issues with concurrency suspected in Vars Middleware, Replacer, Matcher
also the (newly in us) cache-handler/souin "middleware" is one of the suspects.

It's possible that this happened in a "HTTP-Connection-Destructor" or similar related to closing a lot of open tabs, but I could be totally wrong.

Posting this here for future reference:


{"level":"info","ts":1731590006.6006794,"logger":"http.handlers.cache","msg":"Reused response from concurrent request with the key POST-https-test-app.aiprm.com-/e83e6a6a-d8a5-4f07-93b8-5c382e67b4c5?cache=false-e2780c892f1da632ee66eaf799df47596cc068df114a8b93efa74c82bfab79fa"}
==================
WARNING: DATA RACE
Read at 0x00c025080000 by goroutine 418435:
  runtime.slicecopy()
      /usr/local/go/1.21.8/src/runtime/slice.go:310 +0x0
  bytes.(*Buffer).Write()
      /usr/local/go/1.21.8/src/bytes/buffer.go:181 +0x118
  [github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()](http://github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/writer.go:75 +0x1b5
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:399 +0x8b7
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:709 +0x8e
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:710 +0x4f
Previous write at 0x00c025080000 by goroutine 416060:
  runtime.slicecopy()
      /usr/local/go/1.21.8/src/runtime/slice.go:310 +0x0
  bytes.(*Buffer).Write()
      /usr/local/go/1.21.8/src/bytes/buffer.go:181 +0x118
  [github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()](http://github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/writer.go:75 +0x1b5
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:399 +0x8b7
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:709 +0x8e
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:710 +0x4f
Goroutine 418435 (running) created at:
  [github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()](http://github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP())
      /LRT/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:708 +0x1e75
  [github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()](http://github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP())
      /LRT/go/pkg/mod/github.com/caddyserver/cache-handler@v0.12.0/httpcache.go:84 +0x112
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/headers/headers.go:110 +0x4c9
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP())
      <autogenerated>:1 +0x94
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/headers/headers.go:110 +0x4c9
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP())
      <autogenerated>:1 +0x94
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:300 +0x471
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/rewrite/rewrite.go:137 +0x4c1
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP())
      <autogenerated>:1 +0x12b
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:300 +0x471
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/subroute.go:74 +0x96
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:300 +0x471
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/encode/encode.go:138 +0x425
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/headers/headers.go:110 +0x4c9
  [github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP())
      <autogenerated>:1 +0x94
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:331 +0x81
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/routes.go:300 +0x471
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/caddyhttp.go:58 +0x47
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP())
      /LRT/go/pkg/mod/github.com/christophcemper/caddy/v2@v2.7.6-rwmutexplus2/modules/caddyhttp/subroute.go:74 +0x96
  [github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()](http://github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1())


Not able to spend more time on collecting all "standard" details, as it's obvious that none of them help reproduce such rare issues, until we have a way to reproduce both data+timing in a consistent way.

The fork/build used is this one, which already. uses rwmutex + for the Vars Middleware so at least some potential problems can be excluded.

We've seen more Cache/Souin-related DATA RACE problems, as mentioned, but only on local builds.
so

@darkweak
Copy link
Owner

Hey @christophcemper I see that you're using v1.6.47, there were some improvements since v1.7.0 can you try with this version.
I'm trying to find a way to reproduce your issue with v1.7.5 but that's tricky, what's I'm suspecting:
Two request comes to the RP
A (first), B (second)
A goes to the upstream
B waits for the A return
A is canceled
B got an empty response and crashed.

I'll write a unit test/integration test and see if it reproduces the data race.

From the logs: Reused response from concurrent .

@christophcemper
Copy link
Author

christophcemper commented Nov 14, 2024

Thanks for the quick response @darkweak !

Here's another DATA RACE based on Caddy v2.8.4 but not newer souin, for you and Matt hopefully helpful
based on this fork version

  • local build based on 2.8.4-rwmutexplus3
  • LRTcaddy-v2.8.4-v1.4.0-v0.12.0-race-20241115-v2.8.4-rwmutexplus3-local-00:04:09
==================
WARNING: DATA RACE
Read at 0x00c000c77500 by goroutine 19110:
  runtime.slicecopy()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/runtime/slice.go:310 +0x0
  bytes.(*Buffer).Write()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/bytes/buffer.go:181 +0x104
  github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/writer.go:75 +0x120
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:399 +0x5e0
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:709 +0x78
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:710 +0x54

Previous write at 0x00c000c77500 by goroutine 13329:
  runtime.slicecopy()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/runtime/slice.go:310 +0x0
  bytes.(*Buffer).Write()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/bytes/buffer.go:181 +0x104
  github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/writer.go:75 +0x120
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:399 +0x5e0
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:709 +0x78
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:710 +0x54

Goroutine 19110 (running) created at:
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:708 +0x16e0
  github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/caddyserver/cache-handler@v0.12.0/httpcache.go:84 +0x100
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/rewrite/rewrite.go:148 +0x3dc
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()
      <autogenerated>:1 +0xdc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/encode/encode.go:177 +0x62c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:447 +0x170
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:423 +0x5c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:353 +0x10dc
  net/http.serverHandler.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:2938 +0x298
  net/http.initALPNRequest.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:3546 +0x268
  net/http.(*initALPNRequest).ServeHTTP()
      <autogenerated>:1 +0x74
  net/http.Handler.ServeHTTP-fm()
      <autogenerated>:1 +0x60
  golang.org/x/net/http2.(*serverConn).runHandler()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2370 +0x148
  golang.org/x/net/http2.(*serverConn).scheduleHandler.func1()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2305 +0x58

Goroutine 13329 (finished) created at:
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:708 +0x16e0
  github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/caddyserver/cache-handler@v0.12.0/httpcache.go:84 +0x100
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/rewrite/rewrite.go:148 +0x3dc
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()
      <autogenerated>:1 +0xdc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/encode/encode.go:177 +0x62c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:447 +0x170
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:423 +0x5c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:353 +0x10dc
  net/http.serverHandler.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:2938 +0x298
  net/http.initALPNRequest.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:3546 +0x268
  net/http.(*initALPNRequest).ServeHTTP()
      <autogenerated>:1 +0x74
  net/http.Handler.ServeHTTP-fm()
      <autogenerated>:1 +0x60
  golang.org/x/net/http2.(*serverConn).runHandler()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2370 +0x148
  golang.org/x/net/http2.(*serverConn).scheduleHandler.func1()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2305 +0x58
==================

@christophcemper
Copy link
Author

and a 2nd one just came

==================
WARNING: DATA RACE
Read at 0x00c01bee8a80 by goroutine 40980:
  runtime.slicecopy()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/runtime/slice.go:310 +0x0
  bytes.(*Buffer).Write()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/bytes/buffer.go:181 +0x104
  github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/writer.go:75 +0x120
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:399 +0x5e0
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:709 +0x78
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:710 +0x54

Previous write at 0x00c01bee8a80 by goroutine 25831:
  runtime.slicecopy()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/runtime/slice.go:310 +0x0
  bytes.(*Buffer).Write()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/bytes/buffer.go:181 +0x104
  github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/writer.go:75 +0x120
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:399 +0x5e0
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:709 +0x78
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func10()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:710 +0x54

Goroutine 40980 (running) created at:
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:708 +0x16e0
  github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/caddyserver/cache-handler@v0.12.0/httpcache.go:84 +0x100
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/rewrite/rewrite.go:148 +0x3dc
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()
      <autogenerated>:1 +0xdc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/encode/encode.go:177 +0x62c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:447 +0x170
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:423 +0x5c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:353 +0x10dc
  net/http.serverHandler.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:2938 +0x298
  net/http.initALPNRequest.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:3546 +0x268
  net/http.(*initALPNRequest).ServeHTTP()
      <autogenerated>:1 +0x74
  net/http.Handler.ServeHTTP-fm()
      <autogenerated>:1 +0x60
  golang.org/x/net/http2.(*serverConn).runHandler()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2370 +0x148
  golang.org/x/net/http2.(*serverConn).scheduleHandler.func1()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2305 +0x58

Goroutine 25831 (finished) created at:
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.6.47/pkg/middleware/middleware.go:708 +0x16e0
  github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/caddyserver/cache-handler@v0.12.0/httpcache.go:84 +0x100
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/rewrite/rewrite.go:148 +0x3dc
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()
      <autogenerated>:1 +0xdc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/encode/encode.go:177 +0x62c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x380
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x2d8
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:447 +0x170
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:423 +0x5c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:353 +0x10dc
  net/http.serverHandler.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:2938 +0x298
  net/http.initALPNRequest.ServeHTTP()
      /opt/homebrew/Cellar/go@1.21/1.21.8/libexec/src/net/http/server.go:3546 +0x268
  net/http.(*initALPNRequest).ServeHTTP()
      <autogenerated>:1 +0x74
  net/http.Handler.ServeHTTP-fm()
      <autogenerated>:1 +0x60
  golang.org/x/net/http2.(*serverConn).runHandler()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2370 +0x148
  golang.org/x/net/http2.(*serverConn).scheduleHandler.func1()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2305 +0x58
==================

@christophcemper
Copy link
Author

christophcemper commented Nov 14, 2024

here is a DATA RACE using the latest cache-handler 0.15.0 which uses souin 1.7.5
and it appears to be very similar

{"level":"info","ts":1731626570.531391,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 51 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 906)"}
{"level":"info","ts":1731626570.531612,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 50 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 900)"}
{"level":"info","ts":1731626570.531792,"msg":"[VarsRWMutex] WARNING #2: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 100 - 2x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 904)"}
{"level":"info","ts":1731626570.532322,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 51 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 905)"}
{"level":"info","ts":1731626570.532485,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 52 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 909)"}
{"level":"info","ts":1731626570.5332758,"msg":"[VarsRWMutex] WARNING #2: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 101 - 2x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 905)"}
{"level":"info","ts":1731626570.536656,"msg":"[VarsRWMutex] WARNING #2: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 101 - 2x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 906)"}
{"level":"info","ts":1731626570.536695,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 51 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 908)"}
{"level":"info","ts":1731626570.538553,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 52 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 907)"}
{"level":"info","ts":1731626570.541624,"msg":"[VarsRWMutex] WARNING #2: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 101 - 2x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 909)"}
{"level":"info","ts":1731626570.5423732,"msg":"[VarsRWMutex] WARNING #2: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 102 - 2x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 906)"}
{"level":"info","ts":1731626570.542638,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 51 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 907)"}
{"level":"info","ts":1731626570.544359,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 56 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 909)"}
==================
WARNING: DATA RACE
Read at 0x00c000270a80 by goroutine 25689:
  runtime.slicecopy()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/runtime/slice.go:325 +0x0
  bytes.(*Buffer).Write()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/bytes/buffer.go:181 +0x104
  github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/writer.go:77 +0x120
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:491 +0x61c
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:854 +0x12c
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.gowrap6()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:855 +0x54

Previous write at 0x00c000270a80 by goroutine 23368:
  runtime.slicecopy()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/runtime/slice.go:325 +0x0
  bytes.(*Buffer).Write()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/bytes/buffer.go:181 +0x104
  github.com/darkweak/souin/pkg/middleware.(*CustomWriter).Write()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/writer.go:77 +0x120
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).Upstream()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:491 +0x61c
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.func4()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:854 +0x12c
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP.gowrap6()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:855 +0x54

Goroutine 25689 (running) created at:
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:852 +0x1820
  github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/caddyserver/cache-handler@v0.15.0/httpcache.go:88 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/rewrite/rewrite.go:148 +0x3dc
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()
      <autogenerated>:1 +0xdc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/encode/encode.go:177 +0x630
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:447 +0x170
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:423 +0x5c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:353 +0xd10
  net/http.serverHandler.ServeHTTP()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/net/http/server.go:3142 +0x2a8
  net/http.initALPNRequest.ServeHTTP()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/net/http/server.go:3750 +0x268
  net/http.(*initALPNRequest).ServeHTTP()
      <autogenerated>:1 +0x74
  net/http.Handler.ServeHTTP-fm()
      <autogenerated>:1 +0x60
  golang.org/x/net/http2.(*serverConn).runHandler()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2370 +0x144
  golang.org/x/net/http2.(*serverConn).scheduleHandler.gowrap1()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2305 +0x58

Goroutine 23368 (finished) created at:
  github.com/darkweak/souin/pkg/middleware.(*SouinBaseHandler).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/darkweak/souin@v1.7.5/pkg/middleware/middleware.go:852 +0x1820
  github.com/caddyserver/cache-handler.(*SouinCaddyMiddleware).ServeHTTP()
      /Users/christophc/go/pkg/mod/github.com/caddyserver/cache-handler@v0.15.0/httpcache.go:88 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.Rewrite.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/rewrite/rewrite.go:148 +0x3dc
  github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite.(*Rewrite).ServeHTTP()
      <autogenerated>:1 +0xdc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/encode.(*Encode).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/encode/encode.go:177 +0x630
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/headers/headers.go:110 +0x3ac
  github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.(*Handler).ServeHTTP()
      <autogenerated>:1 +0x70
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/subroute.go:74 +0x80
  github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:333 +0xfc
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:300 +0x314
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.RouteList.Compile.wrapRoute.func1.1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/routes.go:268 +0x3e4
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:447 +0x170
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*App).Provision.(*Server).wrapPrimaryRoute.func1()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:423 +0x5c
  github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/caddyhttp.go:58 +0x48
  github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP()
      /Users/christophc/Workspace/common/CaddyLRT/caddy-fork/modules/caddyhttp/server.go:353 +0xd10
  net/http.serverHandler.ServeHTTP()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/net/http/server.go:3142 +0x2a8
  net/http.initALPNRequest.ServeHTTP()
      /Users/christophc/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.9.darwin-arm64/src/net/http/server.go:3750 +0x268
  net/http.(*initALPNRequest).ServeHTTP()
      <autogenerated>:1 +0x74
  net/http.Handler.ServeHTTP-fm()
      <autogenerated>:1 +0x60
  golang.org/x/net/http2.(*serverConn).runHandler()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2370 +0x144
  golang.org/x/net/http2.(*serverConn).scheduleHandler.gowrap1()
      /Users/christophc/go/pkg/mod/golang.org/x/net@v0.25.0/http2/server.go:2305 +0x58
==================
{"level":"info","ts":1731626570.545943,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 52 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 910)"}
{"level":"info","ts":1731626570.546834,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 53 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 908)"}
{"level":"info","ts":1731626570.547193,"msg":"[VarsRWMutex] WARNING #2: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 101 - 2x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 908)"}
{"level":"info","ts":1731626570.551084,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 50 - 1x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 913)"}
{"level":"info","ts":1731626570.552587,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 52 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 908)"}
{"level":"info","ts":1731626570.554632,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 51 - 1x exceeding timeout of 50ms - for 'GetVar matchers.error' (goroutine 910)"}
{"level":"info","ts":1731626570.555694,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 50 - 1x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 914)"}
{"level":"info","ts":1731626570.55626,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 52 - 1x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 913)"}
{"level":"info","ts":1731626570.557375,"msg":"[VarsRWMutex] WARNING #1: HOLDING ReadLock (1 readers)\n ACTIVE ReadLock took 50 - 1x exceeding timeout of 50ms - for 'GetVar client_ip' (goroutine 914)"}

Tracked and built internally here with v2.8.4-rwmutexplus4-cache-0.15.0-souin1.7.5

LRTcaddy-v2.8.4-v1.4.0-v0.15.0-race-20241115-v2.8.4-rwmutexplus4-cache-0.15.0-souin1.7.5-local-00:21:52

@darkweak darkweak linked a pull request Nov 15, 2024 that will close this issue
@darkweak
Copy link
Owner

Hey @christophcemper can you try with the commit 556cf833bdca8015ecfc81f5e9d6062ac1d1a852?

xcaddy build --with github.com/darkweak/souin/plugins/caddy@556cf833bdca8015ecfc81f5e9d6062ac1d1a852 --with github.com/darkweak/souin@556cf833bdca8015ecfc81f5e9d6062ac1d1a852

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