fr-ser / grafana-sqlite-datasource

Grafana Plugin to enable SQLite as a Datasource
Apache License 2.0
126 stars 17 forks source link

High memory usage (possible memory leak) #110

Closed k-bx closed 1 year ago

k-bx commented 1 year ago

Describe the bug Memory usage is quickly growing for the plugin. It's now 865M and was previously multiple gigabytes (before the restart). Whenever I update the dashboard page RAM usage gets up by ~15 Mb. I've made several refreshes and it's now over 1G.

To Reproduce Configure a dashboard with SQLite source. Refresh several times (via "refresh" button in grafana is ok).

Screenshots

зображення зображення

Versions (please complete the following information):

fr-ser commented 1 year ago

Could you please also provide an example dataset and query so I can reproduce the issue?

kosmgco commented 1 year ago

Maybe need to close the conn in query.go:250?

When running a period of time, use lsof command, we can see many opened database file in this process

fr-ser commented 1 year ago

Can you try out if this version fixes the issue: https://github.com/fr-ser/grafana-sqlite-datasource/releases/tag/v3.3.1

k-bx commented 1 year ago

Looks much better now, thank you! @fr-ser Sits on ~30Mb RAM. Will keep an eye on it for a longer period, otherwise marking as fixed.