Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process: expose AW::poll_write_vectored on unix #5216

Merged
merged 3 commits into from
Nov 21, 2022

Conversation

koivunej
Copy link
Contributor

Motivation

For inter-process communication over stdin and stdout it would be helpful to use vectored writes.

Solution

Expose already existing vectored facilities in tokio::io::PollEvented on the AsyncWrite implementation of tokio::process::ChildStdin by providing a forwarding implementation instead of using the default non-vectoring implementation.

Adjusts the tokio::io::PollEvented vectored writes support to be enabled on feature = "process".

@koivunej koivunej force-pushed the expose_childstdin_writev branch from ff0d71a to 9c88def Compare November 21, 2022 08:37
@koivunej
Copy link
Contributor Author

Quite unsure how to test this. tests-integration has process-stdio.rs, one could make a test that a cat being fed on cfg!(unix) a poll_write_vectored completes with 1 poll?

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-process Module: tokio/process labels Nov 21, 2022
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@Darksonn Darksonn enabled auto-merge (squash) November 21, 2022 11:17
@Darksonn Darksonn disabled auto-merge November 21, 2022 11:18
@koivunej koivunej force-pushed the expose_childstdin_writev branch from d7be7c6 to fca1ac6 Compare November 21, 2022 13:19
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Ok looks good to me.

@Darksonn Darksonn enabled auto-merge (squash) November 21, 2022 13:33
@Darksonn Darksonn merged commit f15d14e into tokio-rs:master Nov 21, 2022
@koivunej
Copy link
Contributor Author

@koivunej koivunej deleted the expose_childstdin_writev branch November 21, 2022 14:25
@Darksonn
Copy link
Contributor

Darksonn commented Nov 21, 2022

Yes, that seems to be due to a flaky test. I believe it is related to #5207.

failures:

---- worker_noop_count stdout ----
thread 'main' panicked at 'assertion failed: 2 <= metrics.worker_noop_count(0)', tokio/tests/rt_metrics.rs:131:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    worker_noop_count

on cross-test (aarch64-unknown-linux-gnu)

carllerche added a commit that referenced this pull request Dec 5, 2022
 - net: fix Windows named pipe connect ([#5208])
 - io: support vectored writes for `ChildStdin` ([#5216])
 - io: fix `async fn ready()` false positive for OS-specific events ([#5231])

 ### Changed
 - runtime: `yield_now` defers task until after driver poll ([#5223])
 - runtime: reduce amount of codegen needed per spawned task ([#5213])
 - windows: replace `winapi` dependency with `windows-sys` ([#5204])

 [#5208]: #5208
 [#5216]: #5216
 [#5213]: #5213
 [#5204]: #5204
 [#5223]: #5223
 [#5231]: #5231
carllerche added a commit that referenced this pull request Dec 5, 2022
### Fixed
 - net: fix Windows named pipe connect ([#5208])
 - io: support vectored writes for `ChildStdin` ([#5216])
 - io: fix `async fn ready()` false positive for OS-specific events ([#5231])

 ### Changed
 - runtime: `yield_now` defers task until after driver poll ([#5223])
 - runtime: reduce amount of codegen needed per spawned task ([#5213])
 - windows: replace `winapi` dependency with `windows-sys` ([#5204])

 [#5208]: #5208
 [#5216]: #5216
 [#5213]: #5213
 [#5204]: #5204
 [#5223]: #5223
 [#5231]: #5231
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Dec 23, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | dependencies | minor | `1.22.0` -> `1.23.0` |
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | dev-dependencies | minor | `1.22.0` -> `1.23.0` |

---

### Release Notes

<details>
<summary>tokio-rs/tokio</summary>

### [`v1.23.0`](https://github.com/tokio-rs/tokio/releases/tag/tokio-1.23.0): Tokio v1.23.0

[Compare Source](tokio-rs/tokio@tokio-1.22.0...tokio-1.23.0)

##### Fixed

-   net: fix Windows named pipe connect ([#&#8203;5208])
-   io: support vectored writes for `ChildStdin` ([#&#8203;5216])
-   io: fix `async fn ready()` false positive for OS-specific events ([#&#8203;5231])

##### Changed

-   runtime: `yield_now` defers task until after driver poll ([#&#8203;5223])
-   runtime: reduce amount of codegen needed per spawned task ([#&#8203;5213])
-   windows: replace `winapi` dependency with `windows-sys` ([#&#8203;5204])

[#&#8203;5208]: tokio-rs/tokio#5208

[#&#8203;5216]: tokio-rs/tokio#5216

[#&#8203;5213]: tokio-rs/tokio#5213

[#&#8203;5204]: tokio-rs/tokio#5204

[#&#8203;5223]: tokio-rs/tokio#5223

[#&#8203;5231]: tokio-rs/tokio#5231

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43MC4wIiwidXBkYXRlZEluVmVyIjoiMzQuNzAuMCJ9-->

Co-authored-by: cabr2-bot <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1687
Reviewed-by: crapStone <[email protected]>
Co-authored-by: Calciumdibromid Bot <[email protected]>
Co-committed-by: Calciumdibromid Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-process Module: tokio/process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants