Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Catch exception thrown by HttpConnection constructor and close connection #33190

Merged
merged 2 commits into from
Nov 2, 2018

Conversation

martin-frydl
Copy link
Contributor

@martin-frydl martin-frydl commented Nov 1, 2018

@stephentoub
Copy link
Member

Thank you for porting the fix.

Two things:

  1. Can you please add a corresponding test that would have crashed before the fix and now doesn't?
  2. The managed code base for HttpListener was originally ported from Mono ~2 years ago. Have other fixes gone into that code that we should ensure are also ported over?

cc: @karelz

@martin-frydl
Copy link
Contributor Author

1. Can you please add a corresponding test that would have crashed before the fix and now doesn't?

I can try but I'm not sure whether it will work correctly in tests. The original (old) behavior just crashed whole running process so it will probably crash and skip all following tests. I'm not sure how exactly the tests are run.

2. The managed code base for HttpListener was originally ported from Mono ~2 years ago.  Have other fixes gone into that code that we should ensure are also ported over?

I don't know. I'm not Mono developer, I just run our application on Mono before porting it to .NET Core now. I've checked the bugs we found in Mono implementation before and they all seem to be fixed in .NET Core version, except this one.

@stephentoub
Copy link
Member

I can try but I'm not sure whether it will work correctly in tests. The original (old) behavior just crashed whole running process so it will probably crash and skip all following tests. I'm not sure how exactly the tests are run.

That's fine... with your fix it shouldn't crash, and if it does crash, that'll highlight something else that needs to be fixed.

I just run our application on Mono before porting it to .NET Core now. I've checked the bugs we found in Mono implementation before and they all seem to be fixed in .NET Core version, except this one.

Ok. Thank you for checking.

@karelz
Copy link
Member

karelz commented Nov 1, 2018

@stephentoub do you think it is a good idea to accept a test which uses Reflection on our code base?
I fear it might encourage more developers to use that pattern, which is not something we want IMO.
I would rather rely on fact that nothing is broken (no regression) + manual local test. Thoughts?

@stephentoub
Copy link
Member

do you think it is a good idea to accept a test which uses Reflection on our code base?

In general, no. Why would we do that? I don't see why that's needed here.

@karelz
Copy link
Member

karelz commented Nov 1, 2018

@stephentoub the code that is changed here cannot be reached without tricking BCL via Reflection at this moment - see https://github.com/dotnet/corefx/issues/32280#issuecomment-421440910

@stephentoub
Copy link
Member

the code that is changed here cannot be reached without tricking BCL via Reflection at this moment

I see. Then I think it's fine to just change it without adding a test. The code is just ported from Mono, so if it's currently effectively dead code in corefx, the top priority should be keeping it in sync with the Mono code, which as I understand it has this try/catch.

@karelz
Copy link
Member

karelz commented Nov 1, 2018

@martin-frydl if you can confirm that this change helps your scenario (with using Reflection) locally, we are ready to merge.
Thanks for porting it over!

@martin-frydl
Copy link
Contributor Author

Yes, I can confirm this change fixes the problems.
Thank you for merging.

@stephentoub stephentoub merged commit e4458e6 into dotnet:master Nov 2, 2018
@karelz
Copy link
Member

karelz commented Nov 2, 2018

Thanks for confirmation and for the PR @martin-frydl!

EgorBo pushed a commit to EgorBo/corefx that referenced this pull request Nov 4, 2018
…tion (dotnet#33190)

* Catch exception thrown by HttpConnection constructor and close connection (fixes #32280)

* Blank line added (coding style fix)
@karelz karelz added this to the 3.0 milestone Nov 15, 2018
@pavelchuchma
Copy link

pavelchuchma commented Nov 27, 2018

Hi @karelz, please, is there a way to move this fix to 2.2 release? Martin did this fix to solve existing issue in our product going to be released in next weeks. Waiting several months for Core 3.0 release doesn't help us too much :-(

@karelz
Copy link
Member

karelz commented Nov 27, 2018

@pavelchuchma given that it is a change in unsupported code path and the demand is very low, it will not make it into servicing release of 2.1/2.2.

Your best options in the meantime are: Use 3.0 daily builds (without quality/support guarantees), or patch it yourself and use private builds off 2.2/2.1, or take the code and compile it into your app/library.

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…tion (dotnet/corefx#33190)

* Catch exception thrown by HttpConnection constructor and close connection (fixes dotnet/corefx#32280)

* Blank line added (coding style fix)


Commit migrated from dotnet/corefx@e4458e6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HttpListener crashes application on Linux when SSL connection fails
4 participants