Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112010-02-09T04:44:25ZRuby Issue Tracking System
Redmine Backport191 - Backport #2726 (Closed): udp socket send and receive leak handles on windowshttps://bugs.ruby-lang.org/issues/27262010-02-09T04:44:25Zironfe56 (John Stewart)IronFE56@gmail.com
<p>=begin<br>
UDP receiver:<br>
require 'socket'</p>
<p>dis_socket = Socket.new( Socket::AF_INET, Socket::SOCK_DGRAM, 0 )<br>
dis_socket.bind(Socket.pack_sockaddr_in( 3000, INADDR_ANY ))</p>
<p>while 1<br>
text, sender = dis_socket.recvfrom(65536)<br>
end</p>
<p>UDP sender:<br>
require 'socket'</p>
<p>dis_socket = UDPSocket.open<br>
while 1<br>
dis_socket.send("0123456789", 0, "localhost", 3000)<br>
end</p>
<p>Run one instance of each of the above. Bring up the task manager, add the Handles column, and watch both processes leak handles like a sieve. They appear to leak 1 handle per recvfrom/send call.</p>
<p>The handle count stops around 650k, with seemingly no ill effect. But in more complex programs, file i/o methods start throwing Errno::EBADF exceptions at about the same time the handle count peaks.</p>
<p>Under 1.8.6, the same programs do not leak any handles.</p>
<p>On the possibility it's OS specific, I'm observing the handle leaks on a machine running 64-bit Windows Vista.</p>
<p>It's likely this issue is related to issue <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Handle leak in TCPServer on Windows (Closed)" href="https://bugs.ruby-lang.org/issues/2473">#2473</a>.<br>
=end</p>