GitLab 19.6.1: Sidekiq saturated with `-c 2` (new `Authz::ProjectAuthorizations::RefreshWorker` polling slot)
-
Hi,
Since the package update to GitLab 19.6.1 (image
cloudron/com.gitlab.cloudronapp:202611201720200000, previously 19.5.3), background jobs on our instance are delayed by 1–3 minutes: pipelines start late, issues referenced byCloses #Nare closed minutes after the merge, webhooks are late. The Sidekiq queuedefaultconstantly has 130–150 jobs waiting.Cause
The package starts Sidekiq with a hard-coded concurrency of 2 (
/etc/supervisor/conf.d/sidekiq.conf
command=bundle exec sidekiq -c 2 -C /home/git/gitlab/config/sidekiq_queues.yml -e productionGitLab 19.6 adds the cron
authz_project_authorizations_refresh_worker(config/schedule.yml, every minute). It queues 4 slots ofAuthz::ProjectAuthorizations::RefreshWorker; slot 1 is a polling slot that waits on an empty queue until its 4-minute runtime limit, then is rescheduled immediately (deduplicate :until_executed, if_deduplicated: :reschedule_once). The worker's own comment says: "an idle queue holds one thread".With only 2 threads, this is half of Sidekiq's capacity permanently, on an idle instance. In our
sidekiq.logover 4 hours (03:17–07:27 UTC), this worker used 29,773 s of the ~30,000 s available on the 2 threads (821 runs, slot 1 running ~180 s each time). Average scheduling latency for all other jobs: 73 s, max 181 s.No feature flag disables the polling slot: the
authz_refresh_*flags only change how refresh events are processed, anddo_not_run_safety_net_auth_refresh_jobsonly affectsReverifyProjectAuthorizationsCronWorker.Request
Could the package raise the default Sidekiq concurrency (GitLab's own default is 20), or make it configurable (for example an environment variable or a file in
/app/dataread bystart.sh)? The root filesystem is read-only, so we can't change it ourselves.Environment: Cloudron, GitLab CE 19.6.1, app memory limit 15 GiB (6.6 GiB used)
Thanks!
-
Update: workaround applied while waiting for a package fix.
/app/data/gitlab.ymlis persistent andstart.shonly rewrites specific keys, so I slowed down the new cron there instead of touching the read-only image:production: cron_jobs: authz_project_authorizations_refresh_worker: cron: '*/15 * * * *'then
supervisorctl restart sidekiqinside the app container (no web downtime).With the default 19.6 feature flags (
authz_refresh_compute_*andauthz_refresh_write_pathdisabled,authz_refresh_sidekiq_*enabled), this worker only drops refresh events and authorizations are still refreshed by the existing Sidekiq workers, so running it every 15 minutes instead of every minute should be harmless. The polling slot now holds one of the two threads for about 4 minutes out of 15 instead of permanently.This is only a workaround: a higher or configurable Sidekiq concurrency in the package would still be the real fix.
-
-
Hello @arnaudguy
Thanks for the detailed report.
I can confirm your findings against the GitLab v19.6.1 source- new cron
authz_project_authorizations_refresh_workerruns every minute: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/v19.6.1/config/schedule.yml#L48-50 - polling slot holds one Sidekiq thread on an idle instance by design: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/v19.6.1/app/workers/authz/project_authorizations/refresh_worker.rb#L5-7
- loop runs about 180 s per job and no feature flag stops it: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/v19.6.1/app/services/authz/project_authorizations/refresh_service.rb#L37-60
With the package's hard-coded
sidekiq -c 2, that leaves one thread for everything else.With the default feature flags your
cron_jobsoverride is fine as a temporary workaround. The events are dropped whileauthz_refresh_sidekiq_*is enabled: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/v19.6.1/app/services/authz/project_authorizations/refresh_service.rb#L133-137The fix could be a higher Sidekiq concurrency that scales with the app memory limit.
I will test this and report my findings here. - new cron
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login