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

Async I/O support + ALPN #127

Merged
merged 14 commits into from
Mar 15, 2023
Merged

Async I/O support + ALPN #127

merged 14 commits into from
Mar 15, 2023

Conversation

mzohreva
Copy link
Contributor

No description provided.

@Pagten
Copy link
Contributor

Pagten commented Oct 20, 2020

I went through the PR and it looks good to me, but I don't feel qualified to approve the async-related changes since I hardly have experience with async in rust. @jethrogb are you planning to review this?

@jethrogb
Copy link
Member

jethrogb commented Dec 1, 2020

This will need significant changes after landing #128 which will come first

@jethrogb
Copy link
Member

jethrogb commented Jan 27, 2021

Wrong target branch for the PR (or wrong rebase target)

@mzohreva
Copy link
Contributor Author

This should target v0.6 but 0.6 was master when I opened the PR I think. I'll close this PR for now.

@mzohreva mzohreva closed this Jan 27, 2021
@jethrogb jethrogb reopened this Jan 27, 2021
@jethrogb jethrogb changed the base branch from master to v0.6 January 27, 2021 18:14
@mzohreva mzohreva changed the base branch from v0.6 to v0.7 March 11, 2021 19:19
@jethrogb
Copy link
Member

Can this be rebased on 0.8?

@mzohreva
Copy link
Contributor Author

Can this be rebased on 0.8?

I think it would not be straightforward to rebase this. I'll have to spend some time and do that separately.
But I think we can/should land this in 0.7 since it's being used as is.

@raoulstrackx
Copy link
Contributor

Is there any progress on this? It's blocking other work we need.

@Taowyoo
Copy link
Collaborator

Taowyoo commented Mar 13, 2023

bors try

bors bot added a commit that referenced this pull request Mar 13, 2023
@Taowyoo
Copy link
Collaborator

Taowyoo commented Mar 13, 2023

Yes, there are some tests failed
The verify_chainone needs some more effort. Working on it.

Also add the full test command to ct.sh (without it, tests execute)
Copy link
Contributor

@zugzwang zugzwang left a comment

Choose a reason for hiding this comment

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

The PR looks good to me, but I found misleading test behavior and provided a fix in #225 so that tokio tests actually run in 2.28.0 (see my comment).

Edit: I am not suggesting we update to 2.28.0 in this PR, only that we add the feature and the cargo command.
Edit 2: Finally, this PR can be updated to mbedtls-sys 2.28.0, see the continuation of this thread and #225

[[test]]
name = "async_session"
path = "tests/async_session.rs"
required-features = ["std", "threading", "tokio", "tokio/net", "tokio/io-util", "tokio/macros"]
Copy link
Contributor

@zugzwang zugzwang Mar 13, 2023

Choose a reason for hiding this comment

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

Based on the below, I believe we should add tokio/rt to this list, and make sure the test actually runs in CI with cargo test --features=std,threading,tokio,tokio/net,tokio/io-util,tokio/macros,tokio/rt

Note 1: I did update to mbedtls-sys 2.28.0 to pick up #152 and being able to actually test. See the diff here (a PR to this PR)


Edit: see @Taowyoo's comment below. My comment above still applies, but not for the reasons below.

Note 2: For the following, added an assert!(false) to the very beginning of the client_server_test so it FAILS.

  1. When I run cargo test test::client_server_test (no features), cargo says the test ran ok (I was expecting filtered out, or FAIL, so this is either bad tokio usage in the test suite, or very misleading cargo behavior (might be cargo, see Note above) ❌
  2. When I run cargo test test::client_server_test --features=std,threading,tokio,tokio/net, cargo says the test ran ok (so, same as 1) ❌
  3. When I run cargo test test::client_server_test --features=std,threading,tokio,tokio/net,tokio/io-util,tokio/macros (the features specified here), I finally get a compilation error saying The #[tokio::test] macro requires rt or rt-multi-thread. ✔️
  4. When I run cargo test test::client_server_test --features=std,threading,tokio,tokio/net,tokio/io-util,tokio/macros,tokio/rt, the test is finally ran, resulting in the expected FAILURE. ✔️
  5. When I add tokio/rt to the above list in line 95, the test is not run in my machine by any of the commands given in ct.sh, but they do parse it and report ok as if it had passed. ❌

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi, I think the problem should because we have two tests both has name test::client_server_test , and the logic of using cargo test TEST_NAME is equals to run cargo test but also ask cargo to only run tests whose name includes TEST_NAME. And if you check the output of cargo test test::client_server_test there is no lines of Running tests/async_session.rs ...
The more accurate way is cargo test --test async_session
Then cargo will alert:

error: target `async_session` in package `mbedtls` requires the features: `std`, `threading`, `tokio`, `tokio/net`, `tokio/io-util`, `tokio/macros`, `tokio/rt`
Consider enabling them by passing, e.g., `--features="std threading tokio tokio/net tokio/io-util tokio/macros tokio/rt"

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for spotting this. I did not realize we have two tests with the same name. This explains all.

So, we still need to add tokio/rt to the required dependencies as per my comment, and also make sure the test runs in CI by putting the command in ct.sh

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes.
I updated related CI script in #225

Copy link
Contributor

@zugzwang zugzwang Mar 14, 2023

Choose a reason for hiding this comment

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

Thanks, I will review there.

@bors
Copy link
Contributor

bors bot commented Mar 13, 2023

try

Build failed:

Fix by updating certs with aws.com's certs chain
1. cfg macro related errors

2. wrong type error
Fix error by explicitly specify version for some deps
update ci to be similar to master version
@zugzwang zugzwang self-assigned this Mar 14, 2023
Copy link
Contributor

@zugzwang zugzwang left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

After review and suggested changes addressed by @Taowyoo, this looks good to me.
I will give a tentative approval, subject to @mzohreva agreeing on #225.

I reviewed @Taowyoo's commits in #225. It includes:

  • Updating to mbedtls-sys 2.28.0
  • Make sure tests run on CI
  • Fix CI and build

The plan (again, subject to @mzohreva agreeing to #225) is to either

@Taowyoo
Copy link
Collaborator

Taowyoo commented Mar 15, 2023

Thanks for the PR.

After review and suggested changes addressed by @Taowyoo, this looks good to me. I will give a tentative approval, subject to @mzohreva agreeing on #225.

I reviewed @Taowyoo's commits in #225. It includes:

  • Updating to mbedtls-sys 2.28.0
  • Make sure tests run on CI
  • Fix CI and build

The plan (again, subject to @mzohreva agreeing to #225) is to either

@zugzwang
I think the second option is better, it will distinguish code change in this PR and #225 from #224.
So make it easy to review #224.

Taowyoo and others added 3 commits March 14, 2023 17:58
225: Update to mbedtls-sys 2.28, update test keys, and make sure async tests are run r=Taowyoo a=zugzwang



Co-authored-by: francisco <francisco.vialprado@fortanix.com>
Co-authored-by: Yuxiang Cao <yuxiang.cao@fortanix.com>
@Taowyoo
Copy link
Collaborator

Taowyoo commented Mar 15, 2023

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 15, 2023

Build succeeded:

  • continuous-integration/travis-ci/push

@bors bors bot merged commit 44da8d0 into v0.7 Mar 15, 2023
bors bot added a commit that referenced this pull request Mar 15, 2023
224: Merge async support branch to 0.7 rust-mbedtls r=Taowyoo a=Taowyoo

This is the successor PR for #127 but with some more latest changes needed

Co-authored-by: Raoul Strackx <raoul.strackx@fortanix.com>
Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Co-authored-by: Yuxiang Cao <yuxiang.cao@fortanix.com>
bors bot added a commit that referenced this pull request Mar 15, 2023
224: Merge async support branch to 0.7 rust-mbedtls r=Taowyoo a=Taowyoo

This is the successor PR for #127 but with some more latest changes needed

Co-authored-by: Raoul Strackx <raoul.strackx@fortanix.com>
Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Co-authored-by: Yuxiang Cao <yuxiang.cao@fortanix.com>
@Taowyoo Taowyoo deleted the mz/async-support branch March 21, 2023 22:59
@Taowyoo Taowyoo restored the mz/async-support branch March 21, 2023 23:00
@Taowyoo Taowyoo deleted the mz/async-support branch July 12, 2023 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants