Project

General

Profile

Backport #2726

udp socket send and receive leak handles on windows

Added by ironfe56 (John Stewart) over 9 years ago. Updated 6 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:28118]

Description

=begin
UDP receiver:
require 'socket'

dis_socket = Socket.new( Socket::AF_INET, Socket::SOCK_DGRAM, 0 )
dis_socket.bind(Socket.pack_sockaddr_in( 3000, INADDR_ANY ))

while 1
text, sender = dis_socket.recvfrom(65536)
end

UDP sender:
require 'socket'

dis_socket = UDPSocket.open
while 1
dis_socket.send("0123456789", 0, "localhost", 3000)
end

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.

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.

Under 1.8.6, the same programs do not leak any handles.

On the possibility it's OS specific, I'm observing the handle leaks on a machine running 64-bit Windows Vista.

It's likely this issue is related to issue #2473.
=end

History

#1

Updated by rogerdpack (Roger Pack) over 9 years ago

=begin
appears fixed in ruby 1.9.2dev (2010-02-08 trunk 26621) [i386-mingw32]

Also your snippet requires Socket::INADDR_ANY :)
-r
=end

#2

Updated by jeremyevans0 (Jeremy Evans) 6 days ago

  • Status changed from Open to Closed
  • Description updated (diff)

Also available in: Atom PDF