Shared runner minutes will not reset, throwing 'ZeroDivisionError'
Summary
Shared runner minutes are not reset as this calculation ends up with ZeroDivisionError
. This causes Groups to exhaust the CI/CD minutes allocated to them.
Steps to reproduce
- Enable Feature flag:
ci_parallel_minutes_reset
. - Set shared runner quota
- Run the Sidekiq cron
clear_shared_runners_minutes_worker
manually through Admin UI.
Example Project
What is the current bug behavior?
Shared runners minutes won't reset.
What is the expected correct behavior?
Shared runners minutes should reset.
Relevant logs and/or screenshots
Sidekiq log:
{
"severity": "WARN",
"time": "2021-05-06T04:02:56.077Z",
"queue": "cronjob:clear_shared_runners_minutes",
"args": [],
"class": "ClearSharedRunnersMinutesWorker",
"retry": 0,
"version": 0,
"queue_namespace": "cronjob",
"jid": "26d91b971ed211ab9bf8c5d0",
"created_at": "2021-05-06T04:02:56.053Z",
"meta.caller_id": "Cronjob",
"correlation_id": "01F4ZXFHD3HAT36SN1QJ1T5TY6",
"enqueued_at": "2021-05-06T04:02:56.058Z",
"pid": 2781,
"message": "ClearSharedRunnersMinutesWorker JID-26d91b971ed211ab9bf8c5d0: fail: 0.016661 sec",
"job_status": "fail",
"scheduling_latency_s": 0.001326,
"job_size_bytes": 325,
"cpu_s": 0.004668,
"mem_objects": 1629,
"mem_bytes": 126304,
"mem_mallocs": 493,
"redis_calls": 3,
"redis_duration_s": 0.000732,
"redis_read_bytes": 371,
"redis_write_bytes": 272,
"redis_cache_calls": 2,
"redis_cache_duration_s": 0.00058,
"redis_cache_read_bytes": 370,
"redis_cache_write_bytes": 130,
"redis_queues_calls": 1,
"redis_queues_duration_s": 0.000152,
"redis_queues_read_bytes": 1,
"redis_queues_write_bytes": 142,
"db_count": 2,
"db_write_count": 0,
"db_cached_count": 0,
"duration_s": 0.016661,
"completed_at": "2021-05-06T04:02:56.076Z",
"error_message": "divided by 0",
"error_class": "ZeroDivisionError",
"error_backtrace": [
"ee/app/workers/clear_shared_runners_minutes_worker.rb:21:in `perform'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing.rb:16:in `perform'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb:40:in `perform'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/server.rb:8:in `call'",
"lib/gitlab/application_context.rb:70:in `block in use'",
"lib/gitlab/application_context.rb:70:in `use'",
"lib/gitlab/sidekiq_middleware/worker_context.rb:11:in `wrap_in_optional_context'",
"lib/gitlab/sidekiq_middleware/worker_context/server.rb:17:in `block in call'",
"lib/gitlab/application_context.rb:70:in `block in use'",
"lib/gitlab/application_context.rb:70:in `use'",
"lib/gitlab/application_context.rb:27:in `with_context'",
"lib/gitlab/sidekiq_middleware/worker_context/server.rb:15:in `call'",
"lib/gitlab/sidekiq_status/server_middleware.rb:7:in `call'",
"lib/gitlab/sidekiq_versioning/middleware.rb:9:in `call'",
"lib/gitlab/sidekiq_middleware/admin_mode/server.rb:14:in `call'",
"lib/gitlab/sidekiq_middleware/instrumentation_logger.rb:27:in `call'",
"lib/gitlab/sidekiq_middleware/batch_loader.rb:7:in `call'",
"lib/gitlab/sidekiq_middleware/extra_done_log_metadata.rb:7:in `call'",
"lib/gitlab/sidekiq_middleware/request_store_middleware.rb:10:in `block in call'",
"lib/gitlab/with_request_store.rb:17:in `enabling_request_store'",
"lib/gitlab/with_request_store.rb:10:in `with_request_store'",
"lib/gitlab/sidekiq_middleware/request_store_middleware.rb:9:in `call'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:25:in `block in call'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:48:in `block in instrument'",
"lib/gitlab/metrics/background_transaction.rb:30:in `run'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:48:in `instrument'",
"ee/lib/ee/gitlab/sidekiq_middleware/server_metrics.rb:17:in `instrument'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:24:in `call'",
"lib/gitlab/sidekiq_middleware/monitor.rb:8:in `block in call'",
"lib/gitlab/sidekiq_daemon/monitor.rb:49:in `within_job'",
"lib/gitlab/sidekiq_middleware/monitor.rb:7:in `call'",
"lib/gitlab/sidekiq_logging/structured_logger.rb:19:in `call'"
],
"db_duration_s": 0.002106
}
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.12 Git Version: 2.31.1 Sidekiq Version:5.2.9 Go Version: unknown GitLab information Version: 13.11.3-ee Revision: 7fde0affe23 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.6 URL: https://ps-gitlab.sr.gitlab.support HTTP Clone URL: https://ps-gitlab.sr.gitlab.support/some-group/some-project.git SSH Clone URL: git@ps-gitlab.sr.gitlab.support:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no 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
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.12 Git Version: 2.31.1 Sidekiq Version:5.2.9 Go Version: unknown
GitLab information Version: 13.11.3-ee Revision: 7fde0affe23 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.6 URL: https://ps-gitlab.sr.gitlab.support HTTP Clone URL: https://ps-gitlab.sr.gitlab.support/some-group/some-project.git SSH Clone URL: git@ps-gitlab.sr.gitlab.support:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no 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 root@ps-gitlab:~# sudo gitlab-rake gitlab:check SANITIZE=true 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: ... LDAP is disabled in config/gitlab.yml
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? ... skipped (no tmp uploads folder yet) 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: ... 2/1 ... yes 1/2 ... 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: ... 2 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