⛽ -> ⏲️ Switch from fuel to epoch interruptions. #273
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR has two main parts:
lib/src/execute.rs
andlib/src/linking.rs
)async_io_methods
, which broke as a result of the switch.The epoch switch is straightforward: set the config value on the wasmtime Engine and then attach a thread to the ExecuteCtx which increments the epoch every 50 µs. We also added a Drop implementation to
ExecuteCtx
to join that thread.@jameysharp and I collaborated on chasing down the test issue, namely the
async_io_methods
test had a race condition (alluded to here) that required it to sleep for 100ms to give the backends time to work. The switch to epoch interruptions made that test flaky, so I added an additional backend and request to the test fixture as a synchronization mechanism between the guest and the server. Once the server has read enough bytes to relieve the backpressure on the write body, it will complete the sync request, signaling to the guest that the write body should be ready.