GC Bug .net 2.0.50215

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Async functionality prevents an object from garbage collection.

To reproduce:

Create a socket
establish connection
Create NetworkStream with Ownership Of a socket (or just work socket directly)
Call BeginReceive on stream or socket
dereference network stream
The conneciton will stay up until parent process is terminated.

What GC should be doing is releasing a handle of an underlying socket which
it does not.

pseudo code:

void init()
{
init socket
socket.connect()
init networkstream(owns the socket)
networkstream.beginread(async parameters)
}

void main()
{
for (int j = 0; j < 100; j++)
{
init();
}
GC.Collecti();
GC.WaitForPendingFinalizers();
break here (console read)
}

netstat will show 100 established connections that will never go away.

.



Relevant Pages

  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... kernel socket family. ... presentation side is left to the client. ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... Make it possible for the client socket to be used to go to more than one ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #2]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... Make it possible for the client socket to be used to go to more than one ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • Re: Socket Exception
    ... In this case the server most likely rejected your ... connection. ... Each command is a new socket connection that is opened and closed ... /// Required designer variable. ...
    (microsoft.public.win32.programmer.networks)
  • Re: attn:MVPs
    ... winsock dll to the managed .net environment. ... I have an asynchronous TCP socket that listens for data from ... The Slave should not initiate any connection requests/ send other messages ... EXCEPT the acknowledgement for the incoming messages from master, ...
    (microsoft.public.dotnet.framework)