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

Skip to content

Conversation

@kjpou1
Copy link
Contributor

@kjpou1 kjpou1 commented Jun 12, 2019

Fix problem with fetch response header iteration prematurely disposing of headers object.

  • Modify WasmHttpMessageHandler.cs to use the Headers iterator instead of it's forEach method to iterate over the header values returned.
  • Add regression tests.

Fixes: #14940

kjpou1 added 2 commits June 12, 2019 10:20
…g of the header object.

- Use the iterator of the headers object do iteration over the fetch response headers.
@kjpou1 kjpou1 requested review from kg, lewing and vargaz as code owners June 12, 2019 08:26
@kjpou1
Copy link
Contributor Author

kjpou1 commented Jun 12, 2019

@monojenkins build failed

4 similar comments
@kjpou1
Copy link
Contributor Author

kjpou1 commented Jun 12, 2019

@monojenkins build failed

@kjpou1
Copy link
Contributor Author

kjpou1 commented Jun 12, 2019

@monojenkins build failed

@lewing
Copy link
Member

lewing commented Jun 12, 2019

@monojenkins build failed

@kjpou1
Copy link
Contributor Author

kjpou1 commented Jun 13, 2019

@monojenkins build failed

Copy link
Contributor

@baulig baulig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly dislike this approach. You are replacing a simple loop with a structure of three nested private classes - almost 300 lines of code - that's only used in one single place.

My biggest concern is that we're currently working on size reductions - and by adding something that looks hugely over-engineered and unnecessary to the naive observer - there is a risk that this will eventually get wiped out again during some optimization pass a couple of months down the line.

What I am currently doing is essentially going over each and every single class, asking the question "is this necessary or can it go away?"

From looking at this, I also don't understand why this is needed - how was the old code previously disposing objects and why do we need this private class instead of some more simple approach?

@kjpou1
Copy link
Contributor Author

kjpou1 commented Jun 14, 2019

From looking at this, I also don't understand why this is needed - how was the old code previously disposing objects and why do we need this private class instead of some more simple approach?

Will change this to simpler approach.

kjpou1 added 2 commits June 17, 2019 09:41
- Use the Headers `entries{}` iterator object.
- This replaces the `foreach` delegate call where the object returned in the delegate was being disposed of too early.
- The foreach delegate takes three objects name, value, other.  The `other` being disposed was causing a problem when calling back into the delegate later.
- Removes the lamda expression called by the delegate without the worry of a memory leak if the finally is removed.
@kjpou1
Copy link
Contributor Author

kjpou1 commented Jun 17, 2019

@baulig

Simplified the code. Ready to take another look when you want.

@kjpou1 kjpou1 requested a review from baulig June 17, 2019 09:52
@baulig
Copy link
Contributor

baulig commented Jun 17, 2019

@baulig

Simplified the code. Ready to take another look when you want.

Looks good :-)

@lewing
Copy link
Member

lewing commented Jun 17, 2019

@monojenkins build failed

@lewing lewing merged commit 67b4d55 into mono:master Jun 18, 2019
@kjpou1 kjpou1 deleted the wasm-issue-14940 branch June 18, 2019 03:28
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.

[Wasm] WebAssembly.Net.Http.HttpClient fails under AOT

3 participants