Browse files

Fix race where ECONNREFUSED happens on connect

  • Loading branch information...
1 parent 7f180dd commit 7ad023eb8c5213de1f9c91db178dc20599989f9e Pieter Noordhuis and Tim Labeeuw committed Mar 19, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 warden/spec/container/linux_spec.rb
View
12 warden/spec/container/linux_spec.rb
@@ -129,9 +129,17 @@ def start_warden
end
# Wait for the socket to come up
- until File.exist?(unix_domain_path)
+ loop do
+ begin
+ UNIXSocket.new(unix_domain_path)
+ rescue Errno::ENOENT
+ rescue Errno::ECONNREFUSED
+ else
+ break
+ end
+
if Process.waitpid(@pid, Process::WNOHANG)
- STDERR.puts "Warden process exited before socket was up; aborting spec suite."
+ STDERR.puts "Warden exited early aborting spec suite"
exit 1
end

0 comments on commit 7ad023e

Please sign in to comment.