souin icon indicating copy to clipboard operation
souin copied to clipboard

Traefik Memory keeps increasing with Souin on it

Open omri-shilton opened this issue 7 months ago • 9 comments

Hello, I have enabled Souin on some of my urls in my cluster and im seeing the traefik pod increase its memory infinitely

Image

I have a ttl of 5m in Souin configuration. Is there any way to figure out whats going on?

omri-shilton avatar Jun 09 '25 12:06 omri-shilton

I'm encountering a similar issue on two hosts running the Souin Traefik plugin. I'm currently using version 1.7.7 of the plugin with the following middleware configuration:

labels:
  - traefik.http.middlewares.cache.plugin.souin.api.souin
  - traefik.http.middlewares.cache.plugin.souin.default_cache.ttl=600s
  - traefik.http.middlewares.cache.plugin.souin.default_cache.allowed_http_verbs=GET
  - traefik.http.middlewares.cache.plugin.souin.default_cache.mode=bypass_request
  - traefik.http.middlewares.cache.plugin.souin.default_cache.key.hide=true
  - traefik.http.middlewares.cache.plugin.souin.log_level=debug
  - ...

The Traefik version I'm using is 3.3.2 There is no other Souin-related configuration except the one shown above. Here are the memory metrics of the two affected Traefik instances:

Image

usommerl avatar Jun 23 '25 16:06 usommerl

@darkweak any update on this?

omri-shilton avatar Jul 17 '25 12:07 omri-shilton

@darkweak as of traefik 3.5 they added the use of unsafe operations, how will this affect this middleware?

omri-shilton avatar Jul 28 '25 13:07 omri-shilton

Hey @omri-shilton, sorry for the long delay. That's a memory leak in the storage itself (and probably in the patches to be Yaegi compliant). Do you have a link about the possible unsafe usage in a middleware?

darkweak avatar Jul 28 '25 13:07 darkweak

@darkweak https://github.com/traefik/traefik/pull/11589?ref=containous.ghost.io https://traefik.io/blog/traefik-proxy-v3-5#:~:text=Plugin%20Development%20Evolution

omri-shilton avatar Jul 28 '25 13:07 omri-shilton

@omri-shilton for your information https://github.com/traefik/traefik/issues/11954 😕

darkweak avatar Jul 29 '25 17:07 darkweak

@darkweak I see that no one really acknowledged https://github.com/traefik/yaegi/issues/1702 ... can you think of a workaround for this issue? not having the memory build up? I see that the issues you created relate to the use of unsafe rather than fixing the storage leak, am I correct?

Do you have maybe an example of how I can use souin alongside traefik, not as a plugin?

omri-shilton avatar Dec 03 '25 11:12 omri-shilton

I would recommend to use Caddy instead of Træfik if you're not too dependent on. I'm working on an hybrid in-memory/FS storage for Træfik that can resolve the issue but it takes time and I don't have enough free time to spend on that.

darkweak avatar Dec 03 '25 13:12 darkweak

I would recommend to use Caddy instead of Træfik if you're not too dependent on. I'm working on an hybrid in-memory/FS storage for Træfik that can resolve the issue but it takes time and I don't have enough free time to spend on that.

I'm afraid we are very dependent on Træfik.. Do you have an idea of how to use Souin on the side with Træfik? Is that even possible?

omri-shilton avatar Dec 03 '25 13:12 omri-shilton