Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.

Memory leak #42

Open
muralikg opened this issue Apr 24, 2019 · 4 comments
Open

Memory leak #42

muralikg opened this issue Apr 24, 2019 · 4 comments

Comments

@muralikg
Copy link

Thanks for you work. It has been very helpful 馃憤

Is there a way I can limit the amount of memory used for caching. I have seen caddy run out of memory and not accept subsequent connections after a few hours when caching is enabled.

I would not expect it to use so much memory given that the amount of cache-able content we have is limited. Can you please tell me if there is anything wrong/missing with the configuration

https://domain:443, https://domain:443 {
  bind 0.0.0.0
  proxy / https://origin:443 {
    transparent
    keepalive 5
  }
  cache {
    match_path /static
    path /tmp/caddy_cache
    default_max_age 0
  }
  tls ./keys/cert ./keys/key
  errors /var/log/caddy_error.log {
    rotate_size 100
  }
}

Following graph shows memory usage climbing up when caching is enabled. With no caching and only as a reverse proxy memory usage seems stable.

caddy_memory

Any help would be greatly appreciated. Thanks!

@muralikg
Copy link
Author

I take back that we have limited URLs to cache. We use nginx-pagespeed which generates quite a few static resource urls that are cacheable. And these optimized static resources are generated on the fly based on user agent and those resources have really long expiration(1 year).

Size of cached payloads seems to be way less than peak memory usage of caddy (~800 MB). So I still think there is a leak somewhere else.

du -h --max-depth=1 /tmp/caddy_cache
395M	/tmp/caddy_cache/

@muralikg muralikg changed the title Memory limit Memory leak Apr 26, 2019
@CristianCantoro
Copy link

It seems that I am experiencing the same issue with wikiproxy. Caddy crashes with: fatal error: runtime: out of memory.

I am attaching the complete log for reference: cache-bug-report.log.

CristianCantoro added a commit to CristianCantoro/wikiproxy that referenced this issue Sep 16, 2019
Caching causes caddy to crash with out-of-memory error, see
nicolasazrak/caddy-cache#42
@tearfulDalvik
Copy link

It seems that I am experiencing the same issue with wikiproxy. Caddy crashes with: fatal error: runtime: out of memory.

I am attaching the complete log for reference: cache-bug-report.log.

the same for me 馃槩

@haroon-ali
Copy link

I can confirm the memory leak issue too!

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

No branches or pull requests

4 participants