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

Concurrent collector runs lead to an OOM kill #255

Closed
kokes opened this issue Mar 4, 2024 · 2 comments · Fixed by #256
Closed

Concurrent collector runs lead to an OOM kill #255

kokes opened this issue Mar 4, 2024 · 2 comments · Fixed by #256
Labels

Comments

@kokes
Copy link
Contributor

kokes commented Mar 4, 2024

Maybe somewhat related to the other OOM problems mentioned in other issues, but this time I was able to reproduce the issue. The issue is not some leak or accumulated objects - it's more that the collector is slow and if your Prometheus refresh interval is sufficiently short, multiple concurrent collectors will run, all accumulating their stats into memory, eventually leading to an OOM kill.

To reproduce, I created a bunch of namespaces and TLS issues

#!/bin/bash

num_secrets=500

for ((i=0; i<=$num_secrets; i++))
do
    echo "Generating Secret $i..."

    openssl genrsa -out key$i.pem 2048
    openssl req -new -key key$i.pem -out csr$i.pem -subj "/CN=mydomain.com"
    openssl x509 -req -days 365 -in csr$i.pem -signkey key$i.pem -out cert$i.pem

    kubectl create ns my-namespace-$i
    kubectl create secret tls -n my-namespace-$i my-new-tls-secret-$i --cert=cert$i.pem --key=key$i.pem

    echo "Secret $i created."
done

rm *.pem

And observed memory use of the x509 exporter (both 3.3.0 and 3.12.0).

Screenshot 2024-03-04 at 10 39 47@2x

I do have a potential fix for this, will file it shortly.

@age9990
Copy link

age9990 commented Mar 22, 2024

We have faced the same issue in our environment with thousands of certificate secrets.
Really hope this fix is merged soon.

@monkeynator
Copy link
Member

🎉 This issue has been resolved in version 3.13.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants