Skip to content

Conversation

davidni
Copy link
Contributor

@davidni davidni commented Apr 22, 2020

Fixes #79. At a glance:

  • We were not removing ASP .NET Core's limits on incoming request min data rate. That is a DoS protection mechanism that makes sense for normal http requests, but not for duplex or client-streaming channels. Note that there is precedent to doing what we are doing here. Both HTTP1 upgraded connections, as well as gRPC server middlewares shipped by Microsoft do the same for incoming requests within some criteria
  • We were not flushing bytes to HttpClient's machinery effectively. HttpClient keeps its own buffers on top of the underlying sockets, and we now properly flush bytes when reasonable to do so.

Fixing gRPC streaming at a glance:
   * We were not removing ASP .NET Core's limits on incoming request min data rate. That is a DoS protection mechanism that makes sense for normal http requests, but not for duplex or client-streaming channels. Note that there is precedent to doing what we are doing here. Both HTTP1 upgraded connections, as well as gRPC server middlewares shipped by Microsoft do the same for incoming requests within some criteria
   * We were not flushing bytes to HttpClient's machinery effectively. HttpClient keeps its own buffers on top of the underlying sockets, and we now properly flush bytes when reasonable to do so.
@davidni
Copy link
Contributor Author

davidni commented Apr 22, 2020

This PR is the result of several days of hunting down bugs with proxying gRPC comms. Discalimer: I have not been able to test this in this repo (or even build -- I don't have the preview .NET Core 5 SDK's) I ported changes I made in our internal implementation "by hand", so expect compile issues and possible runtime issues. @Tratcher would be great if you can help with those as my badnwidth is currently limited to contribute here. Thanks!

@analogrelay
Copy link
Contributor

Discalimer: I have not been able to test this in this repo (or even build -- I don't have the preview .NET Core 5 SDK's)

Hmm, the build scripts should take care of this automatically. Did you use the instructions in the README to set up for building/testing in VS? I’d like to make sure the repo is accessible as possible for external contributors so feel free to file bugs for issues you encountered trying to build/test the repo.

@davidni
Copy link
Contributor Author

davidni commented Apr 22, 2020

@anurse Thanks! I was worried that this would sully my dev machine, but I see that clearly you put in the effort to make this clean and easy, it worked great. Might be worthwhile making it even clearer in README that the restore script will NOT install anything globally and won't impair previous installations of .NET Core SDK, VS, etc. I pushed a new commit getting a green build + ported over unit tests.

@analogrelay
Copy link
Contributor

Oh yeah, we don’t want to go back to the world of special build shells or VMs to isolate different build environments :). Being well-isolated and safe for any contributor to use without messing with their machine is part of the design goals for the .NET Engineering System (Arcade) that we’re using here :).

I’ll make a quick update pass over the README to clarify!

@davidni davidni changed the title Fix duplex request proxying (especially gRPC) fix #79 Fix duplex request proxying (especially gRPC) Apr 23, 2020
Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

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

We need to find ways to constrain this workaround more so it doesn't affect non-streaming requests.

@Tratcher Tratcher requested a review from JamesNK April 23, 2020 23:20
@Tratcher
Copy link
Member

@davidni I think we've answered the hard question here and can proceed. Can you handle the cleanup feedback or would you like us to take over?

@davidni
Copy link
Contributor Author

davidni commented Apr 27, 2020

@Tratcher done, I think I addressed all comments.

@Tratcher Tratcher self-assigned this Apr 28, 2020
@Tratcher Tratcher added this to the 1.0.0-preview1 milestone Apr 28, 2020
@Tratcher Tratcher merged commit 69aca0a into dotnet:master Apr 28, 2020
@Tratcher
Copy link
Member

Thanks

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.

Proxying halts or aborts in some configurations (especially gRPC)

6 participants