feat: add support for epoch-based deadline extensions for host I/O#138
Merged
ruslanti merged 2 commits intoMay 13, 2026
Merged
Conversation
- Introduced `epoch_pause_ms` to track elapsed host I/O time and extend execution deadlines. - Enhanced `StoreBuilder` with `epoch_pause_ms` and `max_external_duration_ms` configuration. - Updated HTTP backends to deposit I/O time into shared counters and refund guest execution ticks. - Integrated `epoch_deadline_callback` for dynamic deadline adjustments.
78c93eb to
a8457cb
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces epoch-based deadline extensions by tracking wall-clock time spent in host I/O (notably outbound HTTP) and using that “credit” to extend Wasmtime epoch deadlines, while also adding configurable slack to the outer Tokio timeout.
Changes:
- Added a shared
epoch_pause_mscounter to store state and integrated aepoch_deadline_callbackto extend deadlines based on accumulated host I/O time. - Wired HTTP execution paths/backends to deposit elapsed outbound HTTP time (ms) into
epoch_pause_ms. - Expanded tracing context on request handling and ensured spawned tasks inherit the current tracing span.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/runtime/src/store.rs | Adds epoch pause counter plumbing, max external duration slack, and installs an epoch deadline callback to extend/trap dynamically. |
| crates/runtime/src/lib.rs | Stores the shared counter on Data and deposits wasi-http outbound request wall time into it. |
| crates/http-service/src/lib.rs | Adds an extra span field for request handling tracing. |
| crates/http-service/src/executor/wasi_http.rs | Wires a shared epoch pause counter into the store builder and backend; instruments spawned task with current span. |
| crates/http-service/src/executor/http.rs | Wires a shared epoch pause counter into the store builder and backend for the non-wasi-http executor path. |
| crates/http-backend/src/lib.rs | Deposits outbound HTTP wall time (request + body read) into the shared epoch pause counter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fef1e79 to
05a01f7
Compare
qrdl
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
epoch_pause_msto track elapsed host I/O time and extend execution deadlines.StoreBuilderwithepoch_pause_msandmax_external_duration_msconfiguration.epoch_deadline_callbackfor dynamic deadline adjustments.