ruby-changes:52324
From: normal <ko1@a...>
Date: Sat, 25 Aug 2018 11:32:18 +0900 (JST)
Subject: [ruby-changes:52324] normal:r64532 (trunk): drb: close graceful shutdown pipe before socket
normal 2018-08-25 11:32:15 +0900 (Sat, 25 Aug 2018) New Revision: 64532 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64532 Log: drb: close graceful shutdown pipe before socket Closing a listen socket while entering select(2) may trigger IOError or even deadlock because another thread may give the file descriptor to another file description; meaning the kernel can wait on the wrong description. Modified files: trunk/lib/drb/drb.rb trunk/lib/drb/unix.rb Index: lib/drb/unix.rb =================================================================== --- lib/drb/unix.rb (revision 64531) +++ lib/drb/unix.rb (revision 64532) @@ -95,6 +95,7 @@ module DRb https://github.com/ruby/ruby/blob/trunk/lib/drb/unix.rb#L95 public def close return unless @socket + shutdown # DRbProtocol#shutdown path = @socket.path if @server_mode @socket.close File.unlink(path) if @server_mode Index: lib/drb/drb.rb =================================================================== --- lib/drb/drb.rb (revision 64531) +++ lib/drb/drb.rb (revision 64532) @@ -953,6 +953,7 @@ module DRb https://github.com/ruby/ruby/blob/trunk/lib/drb/drb.rb#L953 # returned by #open or by #accept, then it closes this particular # client-server session. def close + shutdown if @socket @socket.close @socket = nil -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/