Query timeout on issues dashboard
Summary
Requests for the issues dashboard (/dashboard/issues) often result in a 500 response due to "PG::QueryCanceled: ERROR: canceling statement due to statement timeout". It seems that the query params make a difference, but many combinations of query params cause statement timeout. For example, see these Sentry reports:
- assignee_username is empty string
- search is "my-reaction:"
- search is "cesionario:=@pcartes"
- and more
Steps to reproduce
- Visit https://gitlab.com/dashboard/issues?scope=all&utf8=%E2%9C%93&state=opened&search=%5BInstance+Activity%5D+Store+and+read+data+for
- Encounter a 500 error
What is the current bug behavior?
Ordinary search behavior results in a 500 response.
What is the expected correct behavior?
Ordinary search behavior does not result in a 500 response.
Relevant logs and/or screenshots
This problem was noticed after @aakriti.gupta posted a link to "getting the top containers" in an issue comment. That link results in a 500 error "due to statement timeout". The 500 responses occur even after removing the assignee_username
param, removing some of the terms from the search
param, or removing the search
param in favor of other params.
Output of checks
This bug happens on GitLab.com
Possible fixes
- Improve query performance
- Split query into separate queries