Issue filtering on labels doesn't always work

Summary

Filtering issues on certain labels doesn't work. For some labels, the correct result is returned, and for others an empty result is returned.

It seems like it could have something to do with project- vs group-level labels. Trying to filter on group-level labels seem to work, but project-level labels don't work.

Steps to reproduce

  1. Filter on an affected label on the issues page for a project or the group.

Example Project

What is the current bug behavior?

No matching issues are returned.

What is the expected correct behavior?

All the issues that have the corresponding label should be returned.

Relevant logs and/or screenshots

There are definitely issues with this specific label:

with-label

But filtering specifically on it yields no results:

no-results

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Ubuntu 18.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.7.2p137
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.3
Redis Version:	6.0.10
Git Version:	2.31.1
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.11.1-ee
Revision:	557bbaae5b1
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.6
URL:		<>
HTTP Clone URL:	https://<>/some-group/some-project.git
SSH Clone URL:	git@<>:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	yes
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.17.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.17.0 ? ... OK (13.17.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain LDAP authentication... Anonymous. No bind_dn or password configured LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 54 users of 100 limit.

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 4/1 ... yes 4/2 ... yes 5/3 ... yes 5/4 ... yes 4/5 ... yes 6/6 ... yes 4/7 ... yes 6/8 ... yes 6/9 ... yes 4/10 ... yes 4/11 ... yes 4/12 ... yes 6/13 ... yes 4/14 ... yes 5/15 ... yes 4/16 ... yes 6/17 ... yes 4/18 ... yes 4/19 ... yes 4/20 ... yes 4/21 ... yes 66/22 ... yes 4/23 ... yes 6/24 ... yes 4/25 ... yes 4/26 ... yes 8/27 ... yes 10/28 ... yes 16/29 ... yes 18/30 ... yes 22/31 ... yes 23/32 ... yes 24/33 ... yes 29/34 ... yes 30/35 ... yes 34/36 ... yes 35/37 ... yes 37/38 ... yes 40/39 ... yes 41/40 ... yes 43/41 ... yes 45/42 ... yes 50/43 ... yes 45/44 ... yes 7/45 ... yes 4/46 ... yes 4/47 ... yes 45/51 ... yes 4/52 ... yes 45/53 ... yes 39/54 ... yes 45/55 ... yes 45/56 ... yes 41/57 ... yes 4/58 ... yes 54/59 ... yes 15/60 ... yes 24/61 ... yes 23/62 ... yes 56/63 ... yes 4/64 ... yes 4/65 ... yes 4/66 ... yes 4/67 ... yes 4/68 ... yes 51/71 ... yes 65/72 ... yes 61/73 ... yes 59/74 ... yes 4/75 ... yes 62/76 ... yes 4/77 ... yes 24/78 ... yes 4/79 ... yes 45/80 ... yes 56/81 ... yes 4/82 ... yes 66/83 ... yes 18/84 ... yes 41/85 ... yes 45/87 ... yes 4/88 ... yes 4/89 ... yes 4/90 ... yes 35/91 ... yes 18/92 ... yes 50/93 ... yes 41/94 ... yes 45/95 ... yes 5/96 ... yes 45/97 ... yes 68/98 ... yes 37/99 ... yes 4/100 ... yes 41/101 ... yes 16/102 ... yes 70/103 ... yes 45/104 ... yes 71/105 ... yes 69/106 ... yes 35/107 ... yes 66/108 ... yes 18/109 ... yes 8/110 ... yes 41/111 ... yes 62/112 ... yes 69/113 ... yes 62/114 ... yes 70/115 ... yes 45/116 ... yes 70/117 ... yes 72/118 ... yes 41/119 ... yes 45/120 ... yes 74/121 ... yes 4/122 ... yes 4/123 ... yes 34/124 ... yes 4/125 ... yes 41/126 ... yes 69/127 ... yes 41/128 ... yes 68/129 ... yes 65/130 ... yes 75/131 ... yes 18/132 ... yes 69/133 ... yes 50/134 ... yes 69/135 ... yes 27/136 ... yes 69/137 ... yes 50/139 ... yes 24/140 ... yes 4/141 ... yes 18/142 ... yes 8/143 ... yes 45/144 ... yes 30/145 ... yes 77/146 ... yes 50/147 ... yes 61/148 ... yes 50/149 ... yes 4/150 ... yes 45/151 ... yes 45/152 ... yes 50/153 ... yes 4/154 ... yes 41/155 ... yes 18/156 ... yes 4/157 ... yes 41/158 ... yes 66/159 ... yes 45/160 ... yes 56/161 ... yes 45/162 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.31.0 ? ... yes (2.31.1) Git user has default SSH configuration? ... yes Active users: ... 40 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes