Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. GitLab
  3. GitLab 19.6.1: Sidekiq saturated with `-c 2` (new `Authz::ProjectAuthorizations::RefreshWorker` polling slot)

GitLab 19.6.1: Sidekiq saturated with `-c 2` (new `Authz::ProjectAuthorizations::RefreshWorker` polling slot)

Scheduled Pinned Locked Moved GitLab
4 Posts 2 Posters 53 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    A
    arnaudguy
    wrote last edited by james
    #1

    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 by Closes #N are closed minutes after the merge, webhooks are late. The Sidekiq queue default constantly 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 production
    

    GitLab 19.6 adds the cron authz_project_authorizations_refresh_worker (config/schedule.yml, every minute). It queues 4 slots of Authz::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.log over 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, and do_not_run_safety_net_auth_refresh_jobs only affects ReverifyProjectAuthorizationsCronWorker.

    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/data read by start.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!

    1 Reply Last reply
    2
    • A
      A
      arnaudguy
      wrote last edited by
      #2

      Update: workaround applied while waiting for a package fix.

      /app/data/gitlab.yml is persistent and start.sh only 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 sidekiq inside the app container (no web downtime).

      With the default 19.6 feature flags (authz_refresh_compute_* and authz_refresh_write_path disabled, 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.

      1 Reply Last reply
      3
      • jamesJ
        jamesJ
        james
        Staff
        wrote last edited by
        #3

        Hello @arnaudguy
        Thanks for reporting, I will have to look into it.

        1 Reply Last reply
        1
        • jamesJ
          jamesJ
          james
          Staff
          wrote last edited by
          #4

          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_worker runs 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_jobs override is fine as a temporary workaround. The events are dropped while authz_refresh_sidekiq_* is enabled: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/v19.6.1/app/services/authz/project_authorizations/refresh_service.rb#L133-137

          The fix could be a higher Sidekiq concurrency that scales with the app memory limit.
          I will test this and report my findings here.

          1 Reply Last reply
          1

          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
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Bookmarks
          • Search