[go: up one dir, main page]

Skip to content

Sidekiq::Job::EnqueueFromTransactionError: ProcessCommitWorker.perform_in

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/1525648

Sidekiq::Job::EnqueueFromTransactionError: ProcessCommitWorker.perform_in cannot be enqueued inside a transaction as this can lead to (Sidekiq::Job::EnqueueFromTransactionError)
race conditions when the worker runs before the transaction is committed and
tries to access a model that has not been saved yet.

Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead.

  from config/initializers/forbid_sidekiq_in_transactions.rb:38:in `raise_inside_transaction_exception'
  from config/initializers/forbid_sidekiq_in_transactions.rb:53:in `block (2 levels) in <module:NoEnqueueingFromTransactions>'
  from app/workers/concerns/application_worker.rb:119:in `block (4 levels) in <module:ApplicationWorker>'
  from lib/gitlab/sidekiq_sharding/router.rb:37:in `block (2 levels) in route'
  from sidekiq/client.rb:184:in `via'
  from lib/gitlab/sidekiq_sharding/validator.rb:17:in `via'
  from lib/gitlab/sidekiq_sharding/router.rb:36:in `block in route'
  from lib/gitlab/application_context.rb:173:in `block in use'
  from labkit/context.rb:35:in `with_context'
  from lib/gitlab/application_context.rb:173:in `use'
  from lib/gitlab/application_context.rb:96:in `with_context'
  from lib/gitlab/sidekiq_sharding/router.rb:35:in `route'
  from app/workers/concerns/application_worker.rb:118:in `block (3 levels) in <module:ApplicationWorker>'
  from app/services/git/branch_hooks_service.rb:136:in `block in enqueue_process_commit_messages'
  from app/services/git/branch_hooks_service.rb:129:in `each'
  from app/services/git/branch_hooks_service.rb:129:in `enqueue_process_commit_messages'
  from app/services/git/branch_hooks_service.rb:99:in `branch_change_hooks'
  from app/services/git/branch_hooks_service.rb:87:in `execute_branch_hooks'
  from app/services/git/branch_hooks_service.rb:12:in `execute'
  from app/services/git/branch_push_service.rb:78:in `execute_related_hooks'
  from app/services/git/branch_push_service.rb:29:in `execute'
  from ee/git/branch_push_service.rb:17:in `execute'

Proposal

Review and apply suggestions from the error

Edited by 🤖 GitLab Bot 🤖