summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2013-09-03 09:49:44 -0700
committerAndre Arko <andre@arko.net>2013-09-03 09:49:44 -0700
commit29435dd7c060ae432d6c87b1648e60ace1560610 (patch)
treec0b507bc797e0ba8d6e82fe544245762fbe466d7
parentef66cdaedb041c7d4845ff5cfeed058e9e0822a8 (diff)
parent487862b3b777f50d4fa34451783b3deb78c22b3b (diff)
downloadbundler-29435dd7c060ae432d6c87b1648e60ace1560610.tar.gz
Merge pull request #2623 from bundler/fix-thread-safety-parallel-install
Fix thread safety parallel install
-rw-r--r--lib/bundler/parallel_workers/thread_worker.rb7
-rw-r--r--lib/bundler/parallel_workers/unix_worker.rb3
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/bundler/parallel_workers/thread_worker.rb b/lib/bundler/parallel_workers/thread_worker.rb
index eed69dbd3e..ef2c9ecd18 100644
--- a/lib/bundler/parallel_workers/thread_worker.rb
+++ b/lib/bundler/parallel_workers/thread_worker.rb
@@ -12,11 +12,14 @@ module Bundler
def prepare_workers(size, func)
@threads = size.times.map do |i|
Thread.start do
- Thread.current.abort_on_exception = true
loop do
obj = @request_queue.deq
break if obj.equal? POISON
- @response_queue.enq func.call(obj)
+ begin
+ @response_queue.enq func.call(obj, i)
+ rescue Exception => e
+ @response_queue.enq(WrappedException.new(e))
+ end
end
end
end
diff --git a/lib/bundler/parallel_workers/unix_worker.rb b/lib/bundler/parallel_workers/unix_worker.rb
index c7f3f33304..ce7b7fe9ed 100644
--- a/lib/bundler/parallel_workers/unix_worker.rb
+++ b/lib/bundler/parallel_workers/unix_worker.rb
@@ -9,7 +9,7 @@ module Bundler
def work(obj)
Marshal.dump obj, io_w
Marshal.load io_r
- rescue IOError
+ rescue IOError, Errno::EPIPE
nil
end
end
@@ -62,7 +62,6 @@ module Bundler
@threads = size.times.map do |i|
Thread.start do
worker = @workers[i]
- Thread.current.abort_on_exception = true
loop do
obj = @request_queue.deq
break if obj.equal? POISON