Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix Dispose - Avoid sending message when session is not connected. #1096

Closed
wants to merge 3 commits into from
Closed

Conversation

shanwayne
Copy link

@shanwayne shanwayne commented Mar 17, 2023

When connection is disconnected from the server for unexpected reasons, attempting to dispose the forwarded port will throw exception because it believes the session is still connected and will try and send a message.

When connection is disconnected from the server for unexpected reasons, attempting to dispose to forwarded port will throw exception because it believes the session is still connected.
@shanwayne shanwayne requested a review from drieseng as a code owner March 17, 2023 20:43
@shanwayne shanwayne changed the title Avoid sending message when session is not connected. Bugfix Dispose - Avoid sending message when session is not connected. Mar 17, 2023
@shanwayne
Copy link
Author

shanwayne commented Apr 24, 2023

@drieseng Is there any change I can make to help move this forward? I've added a test case which covers the issue.

@WojciechNagorski
Copy link
Collaborator

@shanwayne We're really close to merging #1109 PR which will provide native support for .NET 6 and 7.
After that, I'd like to improve integration tests. Thanks to them, we will find out if this PR didn't introduce any regression.

@WojciechNagorski
Copy link
Collaborator

In ForwardedProtDynamic I found one breaking change for .NET 5 and above. There is a more information

#if NETFRAMEWORK
if (ex.SocketErrorCode != SocketError.Interrupted)
{
RaiseExceptionEvent(ex);
}
#else
// Since .NET 5 the exception has been changed.
// more info https://github.com/dotnet/runtime/issues/41585
if (ex.SocketErrorCode != SocketError.ConnectionAborted)
{
RaiseExceptionEvent(ex);
}
#endif

Do you know if this can be related to this PR?

@shanwayne
Copy link
Author

shanwayne commented Apr 25, 2023

@WojciechNagorski It could be similar but different. In ForwardedPortRemote the Session object is still not null after the connection is aborted and when disposing it attempts to send a message but the client is not connected so an unhandled exception is thrown on dispose. The other ForwardedPort don't have this behavior.

@shanwayne shanwayne closed this Aug 23, 2023
@WojciechNagorski
Copy link
Collaborator

@shanwayne Can I know why did you close this issue? Did you find the problem in the library or maybe on the server side?

I'm waiting for more permissions for this project and intend to reactivate this project once I get them.

@shanwayne
Copy link
Author

shanwayne commented Aug 25, 2023

@WojciechNagorski This is still an issue. I had to move on unfortunately and there was a more serious issue regarding not properly handling connections that prevented using the library. So just cleaning up.

@jwfx
Copy link

jwfx commented Apr 22, 2024

@WojciechNagorski

Any chance this pull request still can be merged? I'm hitting this exact issue on 2024.0.0 and this PR seems to fix it.

@WojciechNagorski
Copy link
Collaborator

@shanwayne @jwfx You should ask @Rob-Hague. I don't have time for this project for the next month.

@WojciechNagorski
Copy link
Collaborator

@Rob-Hague I reopened this PR, if you want you can close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants