Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@steveisok
Copy link
Contributor

Fixes #15805 at least in terms of what may be making it crash.

Adds a null check around the sslStream before trying to dispose.

Adds a null check around the sslStream before trying to dispose.
@baulig
Copy link
Contributor

baulig commented Oct 14, 2019

I have a better idea - checkout my detailed comment here: #15805 (comment).

@steveisok
Copy link
Contributor Author

Works for me!

@steveisok steveisok closed this Oct 14, 2019
@steveisok steveisok reopened this Oct 28, 2019
@baulig baulig merged commit 0c3ffb9 into mono:master Nov 19, 2019
@baulig
Copy link
Contributor

baulig commented Nov 19, 2019

@monojenkins backport 2019-10

@baulig
Copy link
Contributor

baulig commented Nov 19, 2019

This is pretty much impossible to debug without the web-tests instrumentation framework.

Full test case is here: xamarin/web-tests@e37d866.

You have to guarantee that you're inside MonoTlsStream.CreateStream() here:

await sslStream.AuthenticateAsClientAsync (

And then shut down the connection with a subsequent run of the ServicePointScheduler prior to that AuthenticateAsClientAsync() completing. This will call MonoTlsStream.Dispose() here:

monoTlsStream.Dispose ();

Note that a call to HttpWebRequest.Abort() is not guaranteed to trigger this (it could race though) because that will only queue, but not run the ServicePointScheduler - so WebConnection.CloseSocket() is called from the thread pool.

@baulig
Copy link
Contributor

baulig commented Nov 19, 2019

I should also add that the NRE was in fact caught and wrapped inside a WebException - but one of the comments mentioned that some debugging tools seem to always treat any thrown (though caught) NRE as a fatal error.

akoeplinger pushed a commit that referenced this pull request Nov 22, 2019
…noTlsStream

Fixes #15805 at least in terms of what may be making it crash.

Adds a null check around the sslStream before trying to dispose.

Backport of #17270.
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.

Mono.Net.Security.MonoTlsStream: Crash when stream appears to have already been disposed

2 participants