NoMethodError in ElasticIndexBulkCronWorker
While writing up #262693 I stumbled on this log entry.
There seems to be a problematic code path in ElasticIndexBulkCronWorker
.
Kibana log entry
"_source": {
"json.severity": "WARN",
"json.time": "2020-10-06T14:48:03.203Z",
"json.error_class": "NoMethodError",
"json.error_message": "undefined method `issues_access_level' for nil:NilClass",
"json.context": "Job raised exception",
"json.queue": "cronjob:elastic_index_bulk_cron",
"json.args": [],
"json.class": "ElasticIndexBulkCronWorker",
"json.retry": 0,
"json.version": 0,
"json.queue_namespace": "cronjob",
"json.jid": "902a9c161067596ca040625b",
"json.created_at": "2020-10-06T14:48:01.124Z",
"json.meta.caller_id": "Cronjob",
"json.correlation_id": "ba44fadf3581aefddf006fcceed08370",
"json.enqueued_at": "2020-10-06T14:48:01.132Z",
"json.db_count": 571,
"json.db_write_count": 0,
"json.db_cached_count": 110,
"json.error_backtrace": [
"ee/lib/elastic/latest/project_instance_proxy.rb:46:in `public_send'",
"ee/lib/elastic/latest/project_instance_proxy.rb:46:in `block in as_indexed_json'",
"ee/lib/elastic/latest/project_instance_proxy.rb:45:in `each'",
"ee/lib/elastic/latest/project_instance_proxy.rb:45:in `as_indexed_json'",
"ee/lib/elastic/multi_version_util.rb:75:in `as_indexed_json'",
"ee/lib/gitlab/elastic/bulk_indexer.rb:65:in `index'",
"ee/lib/gitlab/elastic/bulk_indexer.rb:39:in `process'",
"ee/app/services/elastic/process_bookkeeping_service.rb:121:in `submit_document'",
"ee/app/services/elastic/process_bookkeeping_service.rb:81:in `block in execute_with_redis'",
"ee/lib/gitlab/elastic/document_reference.rb:27:in `each'",
"ee/lib/gitlab/elastic/document_reference.rb:27:in `each'",
"ee/app/services/elastic/process_bookkeeping_service.rb:81:in `execute_with_redis'",
"ee/app/services/elastic/process_bookkeeping_service.rb:59:in `block in execute'",
"lib/gitlab/redis/wrapper.rb:18:in `block in with'",
"lib/gitlab/redis/wrapper.rb:18:in `with'",
"ee/app/services/elastic/process_bookkeeping_service.rb:54:in `with_redis'",
"ee/app/services/elastic/process_bookkeeping_service.rb:59:in `execute'",
"ee/app/workers/concerns/elastic/bulk_cron_worker.rb:22:in `block in perform'",
"lib/gitlab/exclusive_lease_helpers.rb:38:in `in_lock'",
"ee/app/workers/concerns/elastic/bulk_cron_worker.rb:21:in `perform'",
"lib/gitlab/metrics/sidekiq_middleware.rb:18:in `block in call'",
"lib/gitlab/metrics/transaction.rb:61:in `run'",
"lib/gitlab/metrics/sidekiq_middleware.rb:18:in `call'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing.rb:32: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:52:in `block in use'",
"lib/gitlab/application_context.rb:52:in `use'",
"lib/gitlab/sidekiq_middleware/worker_context.rb:11:in `wrap_in_optional_context'",
"lib/gitlab/sidekiq_middleware/worker_context/server.rb:16: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:8:in `call'",
"lib/gitlab/sidekiq_middleware/instrumentation_logger.rb:7: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:35: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:18:in `call'"
],