Skip to content

Group settings page breaks for large namespace with security policy projects

Summary

As a part of Update delete group message (!178971 - merged) we updated the group settings page to check if the group has any security policy projects before enabling the delete button. The query to get the security policy projects fails with query timeout for large namespaces.

Exception backtrace
"activerecord (7.1.5.1) lib/active_record/connection_adapters/postgresql_adapter.rb:894:in `exec_params'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/postgresql_adapter.rb:894:in `block (2 levels) in exec_no_cache'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract_adapter.rb:1027:in `block in with_raw_connection'",
"activesupport (7.1.5.1) lib/active_support/concurrency/null_lock.rb:9:in `synchronize'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract_adapter.rb:999:in `with_raw_connection'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/postgresql_adapter.rb:893:in `block in exec_no_cache'",
"activesupport (7.1.5.1) lib/active_support/notifications/instrumenter.rb:58:in `instrument'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract_adapter.rb:1142:in `log'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/postgresql_adapter.rb:892:in `exec_no_cache'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/postgresql_adapter.rb:872:in `execute_and_clear'",
"marginalia (1.11.1) lib/marginalia.rb:91:in `execute_and_clear_with_marginalia'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `internal_exec_query'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract/database_statements.rb:630:in `select'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract/database_statements.rb:71:in `select_all'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract/query_cache.rb:112:in `block in select_all'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract/query_cache.rb:152:in `block in cache_sql'",
"activesupport (7.1.5.1) lib/active_support/concurrency/null_lock.rb:9:in `synchronize'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract/query_cache.rb:147:in `cache_sql'",
"activerecord (7.1.5.1) lib/active_record/connection_adapters/abstract/query_cache.rb:112:in `select_all'",
"lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'",
"lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `block in read_using_load_balancer'",
"lib/gitlab/database/load_balancing/load_balancer.rb:65:in `read'",
"lib/gitlab/database/load_balancing/connection_proxy.rb:110:in `read_using_load_balancer'",
"lib/gitlab/database/load_balancing/connection_proxy.rb:48:in `select_all'",
"activerecord (7.1.5.1) lib/active_record/querying.rb:62:in `_query_by_sql'",
"app/models/concerns/use_sql_function_for_primary_key_lookups.rb:10:in `_query_by_sql'",
"activerecord (7.1.5.1) lib/active_record/querying.rb:51:in `find_by_sql'",
"activerecord (7.1.5.1) lib/active_record/statement_cache.rb:150:in `execute'",
"activerecord (7.1.5.1) lib/active_record/associations/association.rb:235:in `find_target'",
"activerecord (7.1.5.1) lib/active_record/associations/singular_association.rb:44:in `find_target'",
"activerecord (7.1.5.1) lib/active_record/associations/association.rb:176:in `load_target'",
"activerecord (7.1.5.1) lib/active_record/associations/association.rb:70:in `reload'",
"activerecord (7.1.5.1) lib/active_record/associations/singular_association.rb:11:in `reader'",
"activerecord (7.1.5.1) lib/active_record/associations/builder/association.rb:104:in `project'",
"ee/app/views/groups/settings/_remove_button_with_security_policies.html.haml:13",
"ee/app/views/groups/settings/_remove_button_with_security_policies.html.haml:12:in `each'",
"ee/app/views/groups/settings/_remove_button_with_security_policies.html.haml:12",
"ee/app/views/groups/settings/_remove_button_with_security_policies.html.haml:8:in `each'",
"ee/app/views/groups/settings/_remove_button_with_security_policies.html.haml:8",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `public_send'",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `_run'",
"actionview (7.1.5.1) lib/action_view/template.rb:261:in `block in render'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/template.rb:556:in `instrument_render_template'",
"actionview (7.1.5.1) lib/action_view/template.rb:249:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:252:in `block in render_partial_template'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:246:in `render_partial_template'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:237:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:83:in `render_partial_to_object'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:55:in `render_partial'",
"actionview (7.1.5.1) lib/action_view/helpers/rendering_helper.rb:44:in `render'",
"app/helpers/application_helper.rb:18:in `render_if_exists'",
"ee/app/views/groups/settings/_delayed_deletion.html.haml:17",
"actionview (7.1.5.1) lib/action_view/helpers/capture_helper.rb:50:in `block in capture'",
"actionview (7.1.5.1) lib/action_view/buffers.rb:75:in `capture'",
"actionview (7.1.5.1) lib/action_view/helpers/capture_helper.rb:50:in `capture'",
"actionview (7.1.5.1) lib/action_view/helpers/form_tag_helper.rb:81:in `form_tag'",
"ee/app/views/groups/settings/_delayed_deletion.html.haml:11",
"actionview (7.1.5.1) lib/action_view/helpers/capture_helper.rb:50:in `block in capture'",
"actionview (7.1.5.1) lib/action_view/buffers.rb:75:in `capture'",
"actionview (7.1.5.1) lib/action_view/helpers/capture_helper.rb:50:in `capture'",
"view_component (3.23.2) lib/view_component/slot.rb:77:in `to_s'",
"app/components/pajamas/card_component.html.haml:7:in `call'",
"view_component (3.23.2) lib/view_component/compiler.rb:98:in `render_template_for'",
"view_component (3.23.2) lib/view_component/base.rb:116:in `render_in'",
"actionview (7.1.5.1) lib/action_view/helpers/rendering_helper.rb:42:in `render'",
"ee/app/views/groups/settings/_delayed_deletion.html.haml:5",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `public_send'",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `_run'",
"actionview (7.1.5.1) lib/action_view/template.rb:261:in `block in render'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/template.rb:556:in `instrument_render_template'",
"actionview (7.1.5.1) lib/action_view/template.rb:249:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:252:in `block in render_partial_template'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:246:in `render_partial_template'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:237:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:83:in `render_partial_to_object'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:55:in `render_partial'",
"actionview (7.1.5.1) lib/action_view/helpers/rendering_helper.rb:44:in `render'",
"app/views/groups/settings/_remove.html.haml:4",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `public_send'",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `_run'",
"actionview (7.1.5.1) lib/action_view/template.rb:261:in `block in render'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/template.rb:556:in `instrument_render_template'",
"actionview (7.1.5.1) lib/action_view/template.rb:249:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:252:in `block in render_partial_template'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:246:in `render_partial_template'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:237:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:83:in `render_partial_to_object'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:55:in `render_partial'",
"actionview (7.1.5.1) lib/action_view/helpers/rendering_helper.rb:44:in `render'",
"app/views/groups/settings/_advanced.html.haml:35",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `public_send'",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `_run'",
"actionview (7.1.5.1) lib/action_view/template.rb:261:in `block in render'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/template.rb:556:in `instrument_render_template'",
"actionview (7.1.5.1) lib/action_view/template.rb:249:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:252:in `block in render_partial_template'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:246:in `render_partial_template'",
"actionview (7.1.5.1) lib/action_view/renderer/partial_renderer.rb:237:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:83:in `render_partial_to_object'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:55:in `render_partial'",
"actionview (7.1.5.1) lib/action_view/helpers/rendering_helper.rb:44:in `render'",
"app/views/groups/edit.html.haml:61",
"actionview (7.1.5.1) lib/action_view/helpers/capture_helper.rb:50:in `block in capture'",
"actionview (7.1.5.1) lib/action_view/buffers.rb:75:in `capture'",
"actionview (7.1.5.1) lib/action_view/helpers/capture_helper.rb:50:in `capture'",
"view_component (3.23.2) lib/view_component/slot.rb:77:in `to_s'",
"app/components/layouts/settings_block_component.haml:25:in `call'",
"view_component (3.23.2) lib/view_component/compiler.rb:98:in `render_template_for'",
"view_component (3.23.2) lib/view_component/base.rb:116:in `render_in'",
"actionview (7.1.5.1) lib/action_view/helpers/rendering_helper.rb:42:in `render'",
"app/views/groups/edit.html.haml:54",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `public_send'",
"actionview (7.1.5.1) lib/action_view/base.rb:263:in `_run'",
"actionview (7.1.5.1) lib/action_view/template.rb:261:in `block in render'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:208:in `instrument'",
"actionview (7.1.5.1) lib/action_view/template.rb:556:in `instrument_render_template'",
"actionview (7.1.5.1) lib/action_view/template.rb:249:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/template_renderer.rb:66:in `block (2 levels) in render_template'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:206:in `block in instrument'",
"activesupport (7.1.5.1) lib/active_support/notifications/instrumenter.rb:58:in `instrument'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:206:in `instrument'",
"actionview (7.1.5.1) lib/action_view/renderer/template_renderer.rb:60:in `block in render_template'",
"actionview (7.1.5.1) lib/action_view/renderer/template_renderer.rb:76:in `block in render_with_layout'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:206:in `block in instrument'",
"activesupport (7.1.5.1) lib/active_support/notifications/instrumenter.rb:58:in `instrument'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:206:in `instrument'",
"actionview (7.1.5.1) lib/action_view/renderer/template_renderer.rb:75:in `render_with_layout'",
"actionview (7.1.5.1) lib/action_view/renderer/template_renderer.rb:59:in `render_template'",
"actionview (7.1.5.1) lib/action_view/renderer/template_renderer.rb:11:in `render'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:63:in `render_template_to_object'",
"actionview (7.1.5.1) lib/action_view/renderer/renderer.rb:31:in `render_to_object'",
"actionview (7.1.5.1) lib/action_view/rendering.rb:135:in `block in _render_template'",
"actionview (7.1.5.1) lib/action_view/base.rb:290:in `in_rendering_context'",
"actionview (7.1.5.1) lib/action_view/rendering.rb:134:in `_render_template'",
"actionpack (7.1.5.1) lib/action_controller/metal/streaming.rb:256:in `_render_template'",
"actionview (7.1.5.1) lib/action_view/rendering.rb:121:in `render_to_body'",
"actionpack (7.1.5.1) lib/action_controller/metal/rendering.rb:158:in `render_to_body'",
"actionpack (7.1.5.1) lib/action_controller/metal/renderers.rb:141:in `render_to_body'",
"actionpack (7.1.5.1) lib/abstract_controller/rendering.rb:27:in `render'",
"actionpack (7.1.5.1) lib/action_controller/metal/rendering.rb:139:in `render'",
"actionpack (7.1.5.1) lib/action_controller/metal/instrumentation.rb:29:in `block (2 levels) in render'",
"benchmark (0.4.0) lib/benchmark.rb:323:in `realtime'",
"activesupport (7.1.5.1) lib/active_support/core_ext/benchmark.rb:14:in `ms'",
"actionpack (7.1.5.1) lib/action_controller/metal/instrumentation.rb:29:in `block in render'",
"actionpack (7.1.5.1) lib/action_controller/metal/instrumentation.rb:98:in `cleanup_view_runtime'",
"activerecord (7.1.5.1) lib/active_record/railties/controller_runtime.rb:39:in `cleanup_view_runtime'",
"elasticsearch-rails (7.2.1) lib/elasticsearch/rails/instrumentation/controller_runtime.rb:37:in `cleanup_view_runtime'",
"actionpack (7.1.5.1) lib/action_controller/metal/instrumentation.rb:28:in `render'",
"app/controllers/application_controller.rb:153:in `render'",
"actionpack (7.1.5.1) lib/action_controller/metal/implicit_render.rb:37:in `default_render'",
"actionpack (7.1.5.1) lib/action_controller/metal/basic_implicit_render.rb:7:in `send_action'",
"actionpack (7.1.5.1) lib/abstract_controller/base.rb:224:in `process_action'",
"actionpack (7.1.5.1) lib/action_controller/metal/rendering.rb:165:in `process_action'",
"actionpack (7.1.5.1) lib/abstract_controller/callbacks.rb:259:in `block in process_action'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:121:in `block in run_callbacks'",
"app/controllers/application_controller.rb:485:in `set_current_admin'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:476:in `set_session_storage'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"lib/gitlab/i18n.rb:116:in `with_locale'",
"lib/gitlab/i18n.rb:122:in `with_user_locale'",
"app/controllers/application_controller.rb:467:in `set_locale'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"app/controllers/application_controller.rb:456:in `set_current_context'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"lib/gitlab/ip_address_state.rb:11:in `with'",
"app/controllers/application_controller.rb:462:in `set_current_ip_address'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"marginalia (1.11.1) lib/marginalia.rb:109:in `record_query_comment'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"sentry-rails (5.23.0) lib/sentry/rails/controller_transaction.rb:34:in `block in sentry_around_action'",
"sentry-ruby (5.23.0) lib/sentry/hub.rb:138:in `with_child_span'",
"sentry-ruby (5.23.0) lib/sentry-ruby.rb:515:in `with_child_span'",
"sentry-rails (5.23.0) lib/sentry/rails/controller_transaction.rb:18:in `sentry_around_action'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:130:in `block in run_callbacks'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:141:in `run_callbacks'",
"actionpack (7.1.5.1) lib/abstract_controller/callbacks.rb:258:in `process_action'",
"actionpack (7.1.5.1) lib/action_controller/metal/rescue.rb:25:in `process_action'",
"actionpack (7.1.5.1) lib/action_controller/metal/instrumentation.rb:74:in `block in process_action'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:206:in `block in instrument'",
"activesupport (7.1.5.1) lib/active_support/notifications/instrumenter.rb:58:in `instrument'",
"activesupport (7.1.5.1) lib/active_support/notifications.rb:206:in `instrument'",
"actionpack (7.1.5.1) lib/action_controller/metal/instrumentation.rb:73:in `process_action'",
"actionpack (7.1.5.1) lib/action_controller/metal/params_wrapper.rb:261:in `process_action'",
"activerecord (7.1.5.1) lib/active_record/railties/controller_runtime.rb:32:in `process_action'",
"actionpack (7.1.5.1) lib/abstract_controller/base.rb:160:in `process'",
"actionview (7.1.5.1) lib/action_view/rendering.rb:40:in `process'",
"actionpack (7.1.5.1) lib/action_controller/metal.rb:227:in `dispatch'",
"actionpack (7.1.5.1) lib/action_controller/metal.rb:307:in `block in dispatch'",
"lib/gitlab/middleware/action_controller_static_context.rb:23:in `call'",
"actionpack (7.1.5.1) lib/action_controller/metal.rb:307:in `dispatch'",
"actionpack (7.1.5.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'",
"actionpack (7.1.5.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'",
"actionpack (7.1.5.1) lib/action_dispatch/routing/mapper.rb:30:in `block in <class:Constraints>'",
"actionpack (7.1.5.1) lib/action_dispatch/routing/mapper.rb:60:in `serve'",
"actionpack (7.1.5.1) lib/action_dispatch/journey/router.rb:51:in `block in serve'",
"config/initializers/action_dispatch_journey_router.rb:52:in `block in find_routes'",
"config/initializers/action_dispatch_journey_router.rb:25:in `map!'",
"config/initializers/action_dispatch_journey_router.rb:25:in `find_routes'",
"actionpack (7.1.5.1) lib/action_dispatch/journey/router.rb:32:in `serve'",
"actionpack (7.1.5.1) lib/action_dispatch/routing/route_set.rb:882:in `call'",
"gitlab-experiment (0.9.1) lib/gitlab/experiment/middleware.rb:19:in `call'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:472:in `call_app!'",
"ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:195:in `call!'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:169:in `call'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:202:in `call!'",
"omniauth (2.1.3) lib/omniauth/strategy.rb:169:in `call'",
"flipper (0.28.3) lib/flipper/middleware/memoizer.rb:72:in `memoized_call'",
"flipper (0.28.3) lib/flipper/middleware/memoizer.rb:37:in `call'",
"lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'",
"lib/gitlab/middleware/sidekiq_shard_awareness_validation.rb:20:in `block in call'",
"lib/gitlab/sidekiq_sharding/validator.rb:42:in `enabled'",
"lib/gitlab/middleware/sidekiq_shard_awareness_validation.rb:20:in `call'",
"lib/gitlab/middleware/memory_report.rb:13:in `call'",
"lib/gitlab/middleware/speedscope.rb:13:in `call'",
"lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'",
"lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'",
"lib/gitlab/etag_caching/middleware.rb:21:in `call'",
"lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'",
"lib/gitlab/metrics/web_transaction.rb:46:in `run'",
"lib/gitlab/metrics/rack_middleware.rb:16:in `call'",
"lib/gitlab/middleware/go.rb:21:in `call'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'",
"lib/gitlab/database/query_analyzer.rb:83:in `within'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
"lib/ci/job_token/middleware.rb:11:in `call'",
"batch-loader (2.0.5) lib/batch_loader/middleware.rb:11:in `call'",
"rack-attack (6.7.0) lib/rack/attack.rb:103:in `call'",
"apollo_upload_server (2.1.6) lib/apollo_upload_server/middleware.rb:19:in `call'",
"lib/gitlab/middleware/multipart.rb:173:in `call'",
"rack-attack (6.7.0) lib/rack/attack.rb:127:in `call'",
"warden (1.2.9) lib/warden/manager.rb:36:in `block in call'",
"warden (1.2.9) lib/warden/manager.rb:34:in `catch'",
"warden (1.2.9) lib/warden/manager.rb:34:in `call'",
"rack-cors (2.0.2) lib/rack/cors.rb:102:in `call'",
"rack (2.2.17) lib/rack/tempfile_reaper.rb:15:in `call'",
"rack (2.2.17) lib/rack/etag.rb:27:in `call'",
"rack (2.2.17) lib/rack/conditional_get.rb:27:in `call'",
"rack (2.2.17) lib/rack/head.rb:12:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/http/permissions_policy.rb:36:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/http/content_security_policy.rb:36:in `call'",
"lib/gitlab/middleware/read_only/controller.rb:40:in `call'",
"lib/gitlab/middleware/read_only.rb:18:in `call'",
"lib/gitlab/middleware/unauthenticated_session_expiry.rb:18:in `call'",
"rack (2.2.17) lib/rack/session/abstract/id.rb:266:in `context'",
"rack (2.2.17) lib/rack/session/abstract/id.rb:260:in `call'",
"lib/gitlab/middleware/secure_headers.rb:11:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/cookies.rb:689:in `call'",
"lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'",
"activesupport (7.1.5.1) lib/active_support/callbacks.rb:101:in `run_callbacks'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/callbacks.rb:28:in `call'",
"sentry-rails (5.23.0) lib/sentry/rails/rescued_exception_interceptor.rb:14:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'",
"lib/gitlab/middleware/path_traversal_check.rb:40:in `call'",
"lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
"sentry-ruby (5.23.0) lib/sentry/rack/capture_exceptions.rb:30:in `block (2 levels) in call'",
"sentry-ruby (5.23.0) lib/sentry/hub.rb:299:in `with_session_tracking'",
"sentry-ruby (5.23.0) lib/sentry-ruby.rb:428:in `with_session_tracking'",
"sentry-ruby (5.23.0) lib/sentry/rack/capture_exceptions.rb:21:in `block in call'",
"sentry-ruby (5.23.0) lib/sentry/hub.rb:89:in `with_scope'",
"sentry-ruby (5.23.0) lib/sentry-ruby.rb:408:in `with_scope'",
"sentry-ruby (5.23.0) lib/sentry/rack/capture_exceptions.rb:20:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'",
"lib/gitlab/middleware/basic_health_check.rb:25:in `call'",
"lograge (0.11.2) lib/lograge/rails_ext/rack/logger.rb:15:in `call_app'",
"railties (7.1.5.1) lib/rails/rack/logger.rb:24:in `block in call'",
"activesupport (7.1.5.1) lib/active_support/tagged_logging.rb:139:in `block in tagged'",
"activesupport (7.1.5.1) lib/active_support/tagged_logging.rb:39:in `tagged'",
"activesupport (7.1.5.1) lib/active_support/tagged_logging.rb:139:in `tagged'",
"activesupport (7.1.5.1) lib/active_support/broadcast_logger.rb:241:in `method_missing'",
"railties (7.1.5.1) lib/rails/rack/logger.rb:24:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/remote_ip.rb:92:in `call'",
"lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'",
"lib/gitlab/middleware/request_context.rb:15:in `call'",
"lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'",
"request_store (1.7.0) lib/request_store/middleware.rb:19:in `call'",
"rack (2.2.17) lib/rack/method_override.rb:24:in `call'",
"rack (2.2.17) lib/rack/runtime.rb:22:in `call'",
"rack-timeout (0.7.0) lib/rack/timeout/core.rb:154:in `block in call'",
"rack-timeout (0.7.0) lib/rack/timeout/support/timeout.rb:19:in `timeout'",
"rack-timeout (0.7.0) lib/rack/timeout/core.rb:153:in `call'",
"config/initializers/fix_local_cache_middleware.rb:11:in `call'",
"lib/gitlab/middleware/compressed_json.rb:44:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/executor.rb:14:in `call'",
"lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'",
"lib/gitlab/metrics/requests_rack_middleware.rb:83:in `call'",
"gitlab-labkit (0.39.0) lib/labkit/middleware/rack.rb:22:in `block in call'",
"gitlab-labkit (0.39.0) lib/labkit/context.rb:35:in `with_context'",
"gitlab-labkit (0.39.0) lib/labkit/middleware/rack.rb:21:in `call'",
"rack (2.2.17) lib/rack/sendfile.rb:110:in `call'",
"actionpack (7.1.5.1) lib/action_dispatch/middleware/request_id.rb:28:in `call'",
"lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'",
"railties (7.1.5.1) lib/rails/engine.rb:536:in `call'",
"railties (7.1.5.1) lib/rails/railtie.rb:226:in `public_send'",
"railties (7.1.5.1) lib/rails/railtie.rb:226:in `method_missing'",
"lib/gitlab/middleware/release_env.rb:12:in `call'",
"rack (2.2.17) lib/rack/urlmap.rb:74:in `block in call'",
"rack (2.2.17) lib/rack/urlmap.rb:58:in `each'",
"rack (2.2.17) lib/rack/urlmap.rb:58:in `call'",
"puma (6.6.0) lib/puma/configuration.rb:279:in `call'",
"puma (6.6.0) lib/puma/request.rb:99:in `block in handle_request'",
"puma (6.6.0) lib/puma/thread_pool.rb:390:in `with_force_shutdown'",
"puma (6.6.0) lib/puma/request.rb:98:in `handle_request'",
"puma (6.6.0) lib/puma/server.rb:472:in `process_client'",
"puma (6.6.0) lib/puma/server.rb:254:in `block in run'",
"puma (6.6.0) lib/puma/thread_pool.rb:167:in `block in spawn_thread'"

As a part of this issue we want to fix it by either optimizing the query or updating the UI to include the security policy projects count.

Steps to reproduce

Example Project

What is the current bug behavior?

What is the expected correct behavior?

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.