You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Socket class has a finalizer, but it shouldn't need to have one. It should be able to rely on the finalizer of SafeSocketHandle to handle finalization when necessary, now that the logic in SafeSocketHandle is reliable as of 5.0.
Having both of these objects be finalizable is problematic since we can't control the order in which their finalizers are called, and this may lead to unexpected behavior. It's also just unneeded overhead in the GC.
I tested removing the finalizer, and everything works fine on Windows. However, on Linux the SafeSocketHandle is not properly collected. I believe this is because there's a reference to the SafeSocketHandle held (indirectly) by the SocketAsyncEngine dictionary. We probably need to make this a weak reference, or otherwise change the code so that the reference is not held.
The Socket class has a finalizer, but it shouldn't need to have one. It should be able to rely on the finalizer of SafeSocketHandle to handle finalization when necessary, now that the logic in SafeSocketHandle is reliable as of 5.0.
Having both of these objects be finalizable is problematic since we can't control the order in which their finalizers are called, and this may lead to unexpected behavior. It's also just unneeded overhead in the GC.
I tested removing the finalizer, and everything works fine on Windows. However, on Linux the SafeSocketHandle is not properly collected. I believe this is because there's a reference to the SafeSocketHandle held (indirectly) by the SocketAsyncEngine dictionary. We probably need to make this a weak reference, or otherwise change the code so that the reference is not held.
@antonfirsov @stephentoub @tmds @wfurt
The text was updated successfully, but these errors were encountered: