summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-09-14 04:56:13 +0000
committerStan Hu <stanhu@gmail.com>2016-09-14 04:56:13 +0000
commit2c9ab6a78f07f4d2d5ead4ac9f76eb59c729ae32 (patch)
tree4a8308321e0eac39628e4c7de6fef615dbb037b8
parent4f6ad25b0d306c7f84ce4ec795ecd3ca9280fef3 (diff)
parentc90174afcd586b7652e527f4506b07ab833c7a87 (diff)
downloadgitlab-ce-2c9ab6a78f07f4d2d5ead4ac9f76eb59c729ae32.tar.gz
Merge branch 'fix/gitlab-popen-thread-safety' into 'master'
Fix Gitlab::Popen.popen thread-safety issue ## What does this MR do? It changes the instance variables of `Gitlab::Popen.popen` to a local ones. ## Are there points in the code the reviewer needs to double check? N/A ## Why was this MR needed? It fixes a bug! ## Screenshots (if relevant) N/A ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - [ ] ~~API support added~~ - Tests - [ ] ~~Added for this feature/bug~~ - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? #21842 See merge request !6194
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab/popen.rb12
2 files changed, 7 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9453401c416..ae5470964ff 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -132,6 +132,7 @@ v 8.12.0 (unreleased)
- Remove duplication between project builds and admin builds view !5680 (Katarzyna Kobierska Ula Budziszewska)
- Deleting source project with existing fork link will close all related merge requests !6177 (Katarzyna Kobierska Ula Budziszeska)
- Return 204 instead of 404 for /ci/api/v1/builds/register.json if no builds are scheduled for a runner !6225
+ - Fix Gitlab::Popen.popen thread-safety issue
v 8.11.6 (unreleased)
- Fix an error where we were unable to create a CommitStatus for running state
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index a0fd41161a5..cc74bb29087 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -18,18 +18,18 @@ module Gitlab
FileUtils.mkdir_p(path)
end
- @cmd_output = ""
- @cmd_status = 0
+ cmd_output = ""
+ cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
yield(stdin) if block_given?
stdin.close
- @cmd_output << stdout.read
- @cmd_output << stderr.read
- @cmd_status = wait_thr.value.exitstatus
+ cmd_output << stdout.read
+ cmd_output << stderr.read
+ cmd_status = wait_thr.value.exitstatus
end
- [@cmd_output, @cmd_status]
+ [cmd_output, cmd_status]
end
end
end