diff options
author | Stan Hu <stanhu@gmail.com> | 2018-11-20 15:07:13 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-11-20 21:43:06 -0800 |
commit | b53d3ac861c8b2f462d77248d5c507f24bcda7c6 (patch) | |
tree | 5a0ba66d89d02329765904bec10459a491b7fc35 /app/services/ci/register_job_service.rb | |
parent | ac6673ddcfda0a0229b86f22543d31ddccc1dc55 (diff) | |
download | gitlab-ce-b53d3ac861c8b2f462d77248d5c507f24bcda7c6.tar.gz |
Work around Ruby 2.5.3 crash when a CI job is selectedsh-workaround-ruby-2-5-3-bug
Ruby 2.5.3 in combination with Rails 5 appears to crash in development
when a CI job is selected for a runner. For some reason, the return
inside the block seems to seg fault. Let's get rid of this since
this isn't a good coding practice in any case.
Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/54281
Also see https://bugs.ruby-lang.org/issues/15325.
Diffstat (limited to 'app/services/ci/register_job_service.rb')
-rw-r--r-- | app/services/ci/register_job_service.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index e06f1c05843..2abc4a67dd6 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -36,7 +36,7 @@ module Ci builds = builds.with_any_tags end - builds.find do |build| + selection = builds.find do |build| next unless runner.can_pick?(build) begin @@ -45,7 +45,7 @@ module Ci if assign_runner!(build, params) register_success(build) - return Result.new(build, true) # rubocop:disable Cop/AvoidReturnFromBlocks + break build end rescue StateMachines::InvalidTransition, ActiveRecord::StaleObjectError # We are looping to find another build that is not conflicting @@ -61,6 +61,8 @@ module Ci end end + return Result.new(selection, true) if selection + register_failure Result.new(nil, valid) end |