A GitLab.com user recently noted that their remote mirror does not update automatically. It works fine if they trigger a manual update. I did some investigating and see some alarming stats.
There are 1,782 remote mirrors on GitLab.com:
irb(main):016:0>RemoteMirror.count=>1782
Of those, only 25 have updated in the past 24 hours. I output one of the partial objects so you can see the last_update_at timestamp showing it has updated today (Nov 30).
The rest have not updated recently. Some updated within the past few days, others haven't updated for weeks or months.
Are these jobs getting triggered? Are they dying in Sidekiq? Is there a bug? I don't see any other reports on the GitLab EE tracker suggesting customers are seeing this in on-prem instances - but that doesn't necessarily mean it's not a bug.
Designs
An error occurred while loading designs. Please try again.
Child items
0
Show closed items
GraphQL error: The resource that you are attempting to access does not exist or you don't have permission to perform this action
No child items are currently open.
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
@dblessing it doesn't look like we have a lot of gitlab_shell execution in the queue lately which matches with this. Could you get a developer checking in the logs to see if there is activity at all?
Just saw this issue after speaking with @gitlab on Twitter about this exact issue. One of my repositories (https://gitlab.com/mike-koch/Mods-for-HESK) is also affected by this issue. Just as @pcarranza said, manual updates of my mirror work fine, while automated updates haven't occurred for about 2 weeks. If there's anything you would like for me to do in order to help solve this issue, let me know; I'd be happy to help in any way possible.
@mike-koch I peeked at your project. Indeed, the update_status is finished and updated_at on 2016-11-18 02:45:15. I don't see anything in the logs that indicate RepositoryUpdateRemoteMirrorWorker was even scheduled for this project.
Calling sync on that mirror seems to have moved the mirror into the started state, but I see no signs of it actually trying to run. The updated_at timestamp is current now.
Listening on the Redis trace, I see it going to the gitlab-shell queue instead of project_mirror:
I don't see any jobs in that queue, though, and I don't see that job ID in our logs. It's as though something just picked it up and dropped it quietly.
It looks to me that UpdateAllRemoteMirrorsWorker is actually failing really error on, which might explain why few of these remote mirror jobs are even being run:
irb(main):031:0>UpdateAllRemoteMirrorsWorker.new.fail_stuck_mirrors!D,[2016-12-02T07:02:52.845746#41814] DEBUG -- : RemoteMirror Load (4.8ms) SELECT "remote_mirrors".* FROM "remote_mirrors" WHERE ("remote_mirrors"."update_status" IN ('started')) AND (last_update_at < '2016-12-01 07:02:52.839467' OR (last_update_at IS NULL AND updated_at < '2016-12-01 07:02:52.839710')) ORDER BY "remote_mirrors"."id" ASC LIMIT 50D,[2016-12-02T07:02:52.848338#41814] DEBUG -- : (0.6ms) BEGIND,[2016-12-02T07:02:52.860694#41814] DEBUG -- : Project Load (5.6ms) SELECT "projects".* FROM "projects" WHERE "projects"."pending_delete" = $1 AND "projects"."id" = $2 ORDER BY "projects"."id" DESC LIMIT 1 [["pending_delete", "f"], ["id", 1085525]]D,[2016-12-02T07:02:52.862495#41814] DEBUG -- : (0.7ms) ROLLBACKNoMethodError:undefinedmethod`import_url' for nil:NilClass from /opt/gitlab/embedded/service/gitlab-rails/app/models/remote_mirror.rb:112:in `url_availability' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:182:in`block in conditional' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `blockincall' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `each'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in`call' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_validate_callbacks'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activemodel-4.2.7.1/lib/active_model/validations.rb:399:in`run_validations!' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activemodel-4.2.7.1/lib/active_model/validations/callbacks.rb:113:in `blockinrun_validations!' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:117:in `call'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:555:in`block (2 levels) in compile' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in`block (2 levels) in halting' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/state_machines-activemodel-0.4.0/lib/state_machines/integrations/active_model.rb:400:in `blockinaround_validation'... 77 levels... from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/metrics/instrumentation.rb:157:in `mark_as_failed'from/opt/gitlab/embedded/service/gitlab-rails/app/workers/update_all_remote_mirrors_worker.rb:13:in`block in fail_stuck_mirrors!' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/batches.rb:51:in `block(2levels)infind_each' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/batches.rb:51:in `each'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/batches.rb:51:in`block in find_each' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/batches.rb:124:in `find_in_batches' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/batches.rb:50:in `find_each'from/opt/gitlab/embedded/service/gitlab-rails/app/workers/update_all_remote_mirrors_worker.rb:12:in`fail_stuck_mirrors!' from (irb):31 from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:in `start' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:in `start'from/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:in`console' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'frombin/rails:9:in`require' from bin/rails:9:in `<main>'
The failed syncs are mostly due to two errors: The mirror user is not allowed to push code to all branches on this project. and The mirror update took too long to complete.