Project

General

Profile

Actions

Backport #2726

closed

udp socket send and receive leak handles on windows

Added by ironfe56 (John Stewart) over 14 years ago. Updated over 5 years ago.

Status:
Closed
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

Actions #1

Updated by rogerdpack (Roger Pack) over 14 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

Actions #2

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

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

Also available in: Atom PDF

Like0
Like0Like0