Skip to content

Conversation

@dicej
Copy link
Contributor

@dicej dicej commented Aug 29, 2024

This addresses two issues:

  • In WasiHttpHandler, we were setting response.Content after calling WasiHttpInterop.ConvertResponseHeaders, which had the effect of removing any content headers we had previously added. The fix is to call WasiHttpInterop.ConvertResponseHeaders after setting response.Content.

  • In WasiEventLoop, we were calling wasi:io/poll#poll regardless of whether any tasks had been canceled during the call to ThreadPoolWorkQueue.Dispatch. That meant the application was not given a chance to quit the event loop promptly, e.g. when tasks are still pending, but the the task(s) the app actually cares about have completed. The fix is to return without polling if we detect one or more tasks have been canceled. The app can always keep looping if it's not ready to exit.

This addresses two issues:

- In `WasiHttpHandler`, we were setting `response.Content` after calling
  `WasiHttpInterop.ConvertResponseHeaders`, which had the effect of removing any
  content headers we had previously added.  The fix is to call
  `WasiHttpInterop.ConvertResponseHeaders` _after_ setting `response.Content`.

- In `WasiEventLoop`, we were calling `wasi:io/poll#poll` regardless of whether
  any tasks had been canceled during the call to `ThreadPoolWorkQueue.Dispatch`.
  That meant the application was not given a chance to quit the event loop
  promptly, e.g. when tasks are still pending, but the the task(s) the app
  actually _cares_ about have completed.  The fix is to return without polling
  if we detect one or more tasks have been canceled.  The app can always keep
  looping if it's not ready to exit.

Signed-off-by: Joel Dice <[email protected]>
@ghost ghost added the area-System.Net.Http label Aug 29, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Aug 29, 2024
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-wasi Related to WASI variant of arch-wasm labels Aug 30, 2024
@pavelsavara pavelsavara self-assigned this Aug 30, 2024
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

@pavelsavara pavelsavara added this to the 10.0.0 milestone Aug 30, 2024
@pavelsavara pavelsavara merged commit dd01b55 into dotnet:main Aug 30, 2024
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Net.Http community-contribution Indicates that the PR has been added by a community member os-wasi Related to WASI variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants