Skip to content

Large pushes to merge requests can cause emails not to be delivered

https://sentry.gitlab.net/gitlab/gitlabcom/issues/3134290/?referrer=gitlab_plugin

Gitlab::SidekiqMiddleware::SizeLimiter::ExceedLimitError: ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper job exceeds payload size limit
  app/services/notification_service.rb:202:in `block in push_to_merge_request'
    mailer.send(:push_to_merge_request_email, recipient.user.id, merge_request.id, current_user.id, recipient.reason, new_commits: new_commits, existing_commits: existing_commits).deliver_later
  app/services/notification_service.rb:201:in `each'
    recipients.each do |recipient|
  app/services/notification_service.rb:201:in `push_to_merge_request'
    recipients.each do |recipient|
  app/services/merge_requests/refresh_service.rb:250:in `notify_about_push'
    notification_service.push_to_merge_request(merge_request, @current_user, new_commits: new_commits, existing_commits: existing_commits)
  app/services/merge_requests/refresh_service.rb:43:in `block in refresh_merge_requests!'
    notify_about_push(mr)
...
(13 additional frame(s) were not displayed)

ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper job exceeds payload size limit

When scheduling the email, we collect all new and old commits' SHA and title. I suspect this causes the messages pushed in to Redis to grow to large, either when there are too many commits, or when one of the commits includes a very long title.

Suggestion

Truncate the list of commits, and the title of each commit before pushing the email-job into Redis.

Edited by Bob Van Landuyt