iawia002 opened PR #9670 from iawia002:wasi-http-writer-buffer
to bytecodealliance:main
:
Please refer to issue #9653 for the background and reasons for the changes.
fix #9653
cc @alexcrichton @pchickey
iawia002 requested pchickey for a review on PR #9670.
iawia002 requested wasmtime-core-reviewers for a review on PR #9670.
pchickey submitted PR review:
Thanks, we never got back to making these buffer depths configurable in WasiHttpView but this is the right path.
Some style notes:
Ideally we'd rewrite the internals to just give the user a single bound on the amount buffered, rather than a combination of number of chunks and chunk size. If you are up for doing that, I believe its the best path forward, but it is trickier than what we have. (Wanting that ideal implementation is mostly why we didn't make this configurable yet.)
Instead of calling it
writer_buffer
call itoutgoing_body_buffer_chunks
, described as the number of distinct write calls to the outgoing body's output-stream that the implementation will buffer.write_budget
should beoutgoing_body_chunk_size
, the maximum size allowed in a write call to the outgoing body's output-stream.The minimum of 2 chunks is an implementation detail related to the way channel reservations work, lets make the default configuration
1
, assert! that any value given is greater than 1, and then always add 1 when creating the channel because one empty slot is required by the way this implementation uses the channel.
pchickey submitted PR review:
Thanks, we never got back to making these buffer depths configurable in WasiHttpView but this is the right path.
Some style notes:
Ideally we'd rewrite the internals to just give the user a single bound on the amount buffered, rather than a combination of number of chunks and chunk size. If you are up for doing that, I believe its the best path forward, but it is trickier than what we have. (Wanting that ideal implementation is mostly why we didn't make this configurable yet.)
Instead of calling it
writer_buffer
call itoutgoing_body_buffer_chunks
, described as the number of distinct write calls to the outgoing body's output-stream that the implementation will buffer.write_budget
should beoutgoing_body_chunk_size
, the maximum size allowed in a write call to the outgoing body's output-stream.The minimum of 2 chunks is an implementation detail related to the way channel reservations work, lets make the default configuration
1
, assert! that any value given is greater than 1, and then always add 1 when creating the channel because one empty slot is required by the way this implementation uses the channel.Also, I don't think we should change the configuration in
wasi-http/tests/all/main.rs
, but instead fix the implementation oftest_programs::http::request
which has the exact same bug I pointed out in your guest in https://github.com/bytecodealliance/wasmtime/issues/9653#issuecomment-2504699703.
pchickey submitted PR review:
Thanks, we never got back to making these buffer depths configurable in WasiHttpView but this is the right path.
Some style notes:
Ideally we'd rewrite the internals to just give the user a single bound on the amount buffered, rather than a combination of number of chunks and chunk size. If you are up for doing that, I believe its the best path forward, but it is trickier than what we have. (Wanting that ideal implementation is mostly why we didn't make this configurable yet.)
Instead of calling it
writer_buffer
call itoutgoing_body_buffer_chunks
, described as the number of distinct write calls to the outgoing body's output-stream that the implementation will buffer.write_budget
should beoutgoing_body_chunk_size
, the maximum size allowed in a write call to the outgoing body's output-stream.The minimum of 2 chunks is an implementation detail related to the way channel reservations work, lets make the default configuration
1
, assert! that any value given is greater than 1, and then always add 1 when creating the channel because one empty slot is required by the way this implementation uses the channel.Also, I don't think we should change the configuration in
wasi-http/tests/all/main.rs
, but instead fix the implementation oftest_programs::http::request
which has the exact same bug I pointed out in your guest in https://github.com/bytecodealliance/wasmtime/issues/9653#issuecomment-2504699703. We should make sure that we have a tests that send a body exceeding the limits on both chunk size and buffer chunks.
iawia002 updated PR #9670.
iawia002 commented on PR #9670:
Hi @pchickey, thanks for the detailed explanation and guidance, I think all comments addressed, PTAL
iawia002 updated PR #9670.
pchickey commented on PR #9670:
Thanks! Its a holiday weekend here and I’ll review this next week.
alexcrichton submitted PR review:
Looks reasonable to me, thanks! (Pat's taking a break for a bit)
I think this is reasonable enough that we can follow-up with further iterations if necessary.
alexcrichton has enabled auto merge for PR #9670.
alexcrichton submitted PR review:
Thanks, we never got back to making these buffer depths configurable in WasiHttpView but this is the right path.
Some style notes:
Ideally we'd rewrite the internals to just give the user a single bound on the amount buffered, rather than a combination of number of chunks and chunk size. If you are up for doing that, I believe its the best path forward, but it is trickier than what we have. (Wanting that ideal implementation is mostly why we didn't make this configurable yet.)
Instead of calling it
writer_buffer
call itoutgoing_body_buffer_chunks
, described as the number of distinct write calls to the outgoing body's output-stream that the implementation will buffer.write_budget
should beoutgoing_body_chunk_size
, the maximum size allowed in a write call to the outgoing body's output-stream.The minimum of 2 chunks is an implementation detail related to the way channel reservations work, lets make the default configuration
1
, assert! that any value given is greater than 1, and then always add 1 when creating the channel because one empty slot is required by the way this implementation uses the channel.Also, I don't think we should change the configuration in
wasi-http/tests/all/main.rs
, but instead fix the implementation oftest_programs::http::request
which has the exact same bug I pointed out in your guest in https://github.com/bytecodealliance/wasmtime/issues/9653#issuecomment-2504699703. We should make sure that we have a tests that send a body exceeding the limits on both chunk size and buffer chunks.
alexcrichton merged PR #9670.
iawia002 commented on PR #9670:
Thanks for the review, I’m currently on vacation, I will intergrate
iawia002 edited a comment on PR #9670:
Thanks for the review, I’m currently on vacation, I will integrate this into wasmtime cli on a few days.
Last updated: Dec 23 2024 at 13:07 UTC