about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-03-22 08:43:33 +0000
committerEric Wong <e@80x24.org>2014-03-22 08:54:43 +0000
commit95975647c0759f1c141c8627a2826fa8c706258d (patch)
tree135803eb6d16320c239adad70cc4650e29c7564b
parent4b8a59a8c01fefe7723caa17a44e9afdc74e0bbb (diff)
downloadyahns-95975647c0759f1c141c8627a2826fa8c706258d.tar.gz
GC will close redundantly and lead to EBADF when finalizing.  This was
probably harmless as the original IO objects remained marked; but do
not count on it.  Seeing EBADF in a MT process is a very bad sign
(inadvertant information disclosure is only one race condition away).
Fortunately, this bug was limited to our test suite :)
-rw-r--r--test/server_helper.rb1
-rw-r--r--test/test_server.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/test/server_helper.rb b/test/server_helper.rb
index a92a2da..856ff99 100644
--- a/test/server_helper.rb
+++ b/test/server_helper.rb
@@ -75,6 +75,7 @@ module ServerHelper
   def mkserver(cfg)
     fork do
       ENV["YAHNS_FD"] = @srv.fileno.to_s
+      @srv.autoclose = false
       yield if block_given?
       Yahns::Server.new(cfg).start.join
     end
diff --git a/test/test_server.rb b/test/test_server.rb
index 96fc704..bd38ce3 100644
--- a/test/test_server.rb
+++ b/test/test_server.rb
@@ -227,6 +227,7 @@ class TestServer < Testcase
     pid = fork do
       bpipe[1].close
       ENV["YAHNS_FD"] = unix_srv.fileno.to_s
+      unix_srv.autoclose = false
       srv.start.join
     end
     bpipe[0].close