Bug #2473: Handle leak in TCPServer on Windows
http://redmine.ruby-lang.org/issues/show/2473

Author: Tim Walters
Status: Open, Priority: Normal
ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswn32]

1. Run the following program on Windows (XP, haven't tried others) using Ruby 1.9.1p0:

require 'socket'

server = TCPServer.open(2000)
while (true)
  socket = server.accept
  cmd = socket.readline.chomp
  puts cmd
  socket.close
end

2. Open the task manager, add "Handles" to the columns being viewed, and observe how many handles are being used.

3. Open an irb window and execute the following lines:

> s = TCPSocket.new('localhost', 2000)
> s.puts('foo')

4. In the task manager, note that the number of handles used by the first process has increased. Every time you connect, three handles are added; when you write and the socket is closed, only two are released.

5. Try the same instructions using Ruby 1.8.2. All the handles are released, and there is no leak.


----------------------------------------
http://redmine.ruby-lang.org