When socket.ConnectAsync() throws an error synchronously, SocketAsyncEventArgs is not disposed
Description
Related to CSHARP-691, in the case when socket.ConnectAsync(e) throws an error synchronously the driver is not disposing the event args.
In that case, the resources are not going to be freed until the finalizer is called.
Note that as the driver properly configures the socket, ConnectAsync() will complete asynchronously in most cases (IO pending), even if there is no process listening on the remote port or the address can't be reached. I could reproduce sync completion of ConnectAsync() only when connecting to a port that is listening on a local interface w/ Linux under .NET Core 2.0+.
Related to CSHARP-691, in the case when
socket.ConnectAsync(e)
throws an error synchronously the driver is not disposing the event args.In that case, the resources are not going to be freed until the finalizer is called.
Note that as the driver properly configures the socket,
ConnectAsync()
will complete asynchronously in most cases (IO pending), even if there is no process listening on the remote port or the address can't be reached. I could reproduce sync completion ofConnectAsync()
only when connecting to a port that is listening on a local interface w/ Linux under .NET Core 2.0+.