-
Notifications
You must be signed in to change notification settings - Fork 75
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
Plugin memory usage constantly growing #1102
Comments
Hey thanks for submitting this info, I appreciate the detail. There's a few open issues on the clickhouse-go repository related to memory, let me know if any of those sound similar to what you're observing here: https://github.com/ClickHouse/clickhouse-go/issues |
Hi, I do see an issue about a goroutine leak that arises from making queries, although in our go routine pprof there are no instances of this, only lots of connectionOpeners. There are other issues are related to inserts but we are only issuing select queries using this datasource. |
Thanks for checking those. Could you provide some more details about how you're connecting? Config details such as TLS, HTTP/Native, etc. |
We have tried connecting with no TLS and Native, and TLS and HTTP. Both have the same memory footprint. We also don't set any custom settings, would be using the default DialTimeout/QueryTimeout, custom settings. |
@SpencerTorres Just a quick ping here. I don't want to loose momentum. I'll message you. |
Hey @srclosson! I haven't had time to look into this yet. It seems like this is the only case of memory usage growing in a plugin use case.
It's possible there is a memory leak related to connections, but I am also wondering why it's making so many connections in the first place. Perhaps some kind of TCP network configuration causing the connection to drop/fail? @wgpdt which version of ClickHouse is this? Is it self hosted or ClickHouse Cloud? |
Hi @SpencerTorres, we're using self hosted clickhouse. The issue is likely on the grafana side, perhaps with how the plug in is used. We are also utilising grafana's alert manager, which runs a large number of queries. |
@SpencerTorres Is there something we can do to help move things forward? |
@SpencerTorres I really need to hear what the plan is? Where are we in the queue? |
@srclosson apologies for the delay, it looks like this is being investigated/addressed in #1154 by @adamyeats |
What happened:
We are using an instance of the clickhouse plugin in grafana to periodically query a database. The memory profile of the grafana instance is strictly increasing over time. This memory growth can be attributed to the clickhouse plugin, which shows strictly increasing memory when making connections and querying data. This results in an eventual OOM of the process over the course of some number of days.
Collecting heap profiles over time indicates memory used for the database connection increases over time.
Taking consecutive goroutine profiles show that the number of connectionOpener processes are also strictly increasing:
What you expected to happen:
The memory usage is stable over time.
Anything else we need to know?:
Some code references are given below:
New datasources are created here
Connect opens a sql db connection here
Within this:
The db is opened via clickhouse-go
Which is ultimately being opened by a connection opener
The ping context also shows continously increasing memory.
Additionally, it looks like connections are created when a new datasource is created, and a new datasource is created if the grafana config is updated.
Environment:
We also noticed this in plugin version 4.3.2.
The text was updated successfully, but these errors were encountered: