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

SQL connection leak #12636

Closed
mirwaiso opened this Issue Jul 17, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@mirwaiso
Copy link

commented Jul 17, 2018

if version := engineCache.versions[dsInfo.Id]; version == dsInfo.Version {

There has been quite a few issues (which surprisingly seems to have been solved) about this: #8513, #9827 .... The problem is as soon as you have a dashboard and opening a second one in a browser or even keep refresh rate very low, you will see that new connections to postgres Server are made (I think other SQL Servers have the same problem as they also use this SQL generic engine).
After some digging I found out this part where the cache is looked up for a version. But this version is never set -or I don't see it at least- that is why a new engine is always created instead of using the one from cache.
So a possible fix would be this:
engineCache.versions[dsInfo.Id] = dsInfo.Version in line 70 somewhere.
At least this works in my case, but I don't know fully if this breaks something else? Or why are you using versions at all?

torkelo added a commit that referenced this issue Jul 18, 2018

@torkelo torkelo added this to the 5.2.2 milestone Jul 18, 2018

torkelo added a commit that referenced this issue Jul 18, 2018

@torkelo

This comment has been minimized.

Copy link
Member

commented Jul 18, 2018

thanks for reporting this!

ryantxu added a commit to NatelEnergy/grafana that referenced this issue Jul 23, 2018

Merge remote-tracking branch 'grafana/master'
* grafana/master: (51 commits)
  changing callback fn into arrow functions for correct usage of this (grafana#12673)
  Fix requested changes
  Update CHANGELOG.md
  Add support for interval in query variable
  Change to arrow functions
  Add graph_ctrl jest
  changelog: add notes about closing grafana#12691
  Update kbn.ts
  Add jest test file
  Id validation of CloudWatch GetMetricData
  changelog: adds note for grafana#11487
  Datasource for Grafana logging platform
  fix: postgres/mysql engine cache was not being used, fixes grafana#12636 (grafana#12642)
  added: replaces added to grafana
  fix: datasource search was not working properly
  docs: minor docs fix
  Fix label suggestions in Explore query field
  pluginloader: expose flot gauge plugin
  alert: add missing test after refactor
  Handle query string in storage public_url (grafana#9351) (grafana#12555)
  ...

ryantxu added a commit to ryantxu/grafana that referenced this issue Jul 23, 2018

Merge remote-tracking branch 'grafana/master' into panel-visibility-flag
* grafana/master: (51 commits)
  changing callback fn into arrow functions for correct usage of this (grafana#12673)
  Fix requested changes
  Update CHANGELOG.md
  Add support for interval in query variable
  Change to arrow functions
  Add graph_ctrl jest
  changelog: add notes about closing grafana#12691
  Update kbn.ts
  Add jest test file
  Id validation of CloudWatch GetMetricData
  changelog: adds note for grafana#11487
  Datasource for Grafana logging platform
  fix: postgres/mysql engine cache was not being used, fixes grafana#12636 (grafana#12642)
  added: replaces added to grafana
  fix: datasource search was not working properly
  docs: minor docs fix
  Fix label suggestions in Explore query field
  pluginloader: expose flot gauge plugin
  alert: add missing test after refactor
  Handle query string in storage public_url (grafana#9351) (grafana#12555)
  ...

ryantxu added a commit to ryantxu/grafana that referenced this issue Jul 23, 2018

Merge remote-tracking branch 'grafana/master'
* grafana/master: (51 commits)
  changing callback fn into arrow functions for correct usage of this (grafana#12673)
  Fix requested changes
  Update CHANGELOG.md
  Add support for interval in query variable
  Change to arrow functions
  Add graph_ctrl jest
  changelog: add notes about closing grafana#12691
  Update kbn.ts
  Add jest test file
  Id validation of CloudWatch GetMetricData
  changelog: adds note for grafana#11487
  Datasource for Grafana logging platform
  fix: postgres/mysql engine cache was not being used, fixes grafana#12636 (grafana#12642)
  added: replaces added to grafana
  fix: datasource search was not working properly
  docs: minor docs fix
  Fix label suggestions in Explore query field
  pluginloader: expose flot gauge plugin
  alert: add missing test after refactor
  Handle query string in storage public_url (grafana#9351) (grafana#12555)
  ...

marefr added a commit that referenced this issue Jul 24, 2018

marefr added a commit that referenced this issue Jul 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.