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

Check that Zebra is only using one version of tokio #2987

Closed
wants to merge 26 commits into from

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Nov 1, 2021

Motivation

Duplicate tokio dependencies might result in hard-to-diagnose bugs in Zebra.
This happens because code expects a single instance of some structs, but there are multiple instances running.

If we add duplicate dependencies, Zebra compiles slower, and its binaries will be larger.
This slows down CI, and can fill up CI disks.

Scheduling

This is unexpected work in Sprint 21, to make sure that tokio is upgraded correctly.

It should be merged with the tokio roll-up PR.

Solution

  • Require a single tokio version in deny.toml
  • Ban tokio git sources in deny.toml
  • Allow remaining and new duplicates caused by the tokio upgrade

Review

@jvff should review this PR.

It is based on PR #2986.

Reviewer Checklist

  • CI passes when combined with the tokio upgrades
  • deny.toml changes makes sense

@teor2345 teor2345 added A-dependencies Area: Dependency file updates C-enhancement Category: This is an improvement P-Medium labels Nov 1, 2021
@teor2345 teor2345 added this to the 2021 Sprint 21 milestone Nov 1, 2021
@teor2345 teor2345 requested a review from jvff November 1, 2021 00:12
@teor2345 teor2345 self-assigned this Nov 1, 2021
@teor2345 teor2345 changed the base branch from main to duplicate-dependencies-ci November 1, 2021 00:13
@teor2345 teor2345 force-pushed the duplicate-dependencies-ci branch from 5f88b00 to 3539dc5 Compare November 1, 2021 01:56
@teor2345 teor2345 force-pushed the single-tokio-version branch from 7466baf to fdbbb66 Compare November 1, 2021 02:01
@teor2345 teor2345 mentioned this pull request Nov 1, 2021
3 tasks
@mpguerra mpguerra removed this from the 2021 Sprint 21 milestone Nov 1, 2021
jvff
jvff previously approved these changes Nov 1, 2021
@jvff
Copy link
Contributor

jvff commented Nov 1, 2021

Nice catch! I didn't know about that file 😓

EDIT: Nevermind, just realized this is an extension of #2986.

@jvff
Copy link
Contributor

jvff commented Nov 1, 2021

Would it make sense to merge this PR into #2986 and merge this after the Tokio upgrade? That would help to avoid feature creep in the rollup PR. IMHO, we could upgrade to Tokio first, and then fix any bugs that this PR finds afterwards.

Base automatically changed from duplicate-dependencies-ci to main November 1, 2021 21:19
@teor2345
Copy link
Contributor Author

teor2345 commented Nov 1, 2021

Would it make sense to merge this PR into #2986 and merge this after the Tokio upgrade? That would help to avoid feature creep in the rollup PR. IMHO, we could upgrade to Tokio first, and then fix any bugs that this PR finds afterwards.

This PR tests that the dependencies are correct in the rollup PR.

Duplicate crates can cause weird runtime errors and test failures.
The duplicate checks might also reveal missed dependency updates, which could require extra code updates.

So I think it's helpful to include it in the rollup, to avoid a half-broken main branch.

jvff added 13 commits November 2, 2021 00:15
Update to latest version to add support for Tokio version 1.
It was deprecated in favor of `ServiceExt::ready`.
This will break the build because the code isn't ready for the update,
but future commits will fix the issues.
Use `futures::stream::StreamExt` instead, because newer versions of
Tokio don't have the `stream` feature.
In newer versions of Tokio `Interval` doesn't implement `Stream`, so the
wrapper types from `tokio-stream` have to be used instead.
In newer versions of Tokio the `Interval` type doesn't implement
`Stream`, so `tokio_stream::wrappers::IntervalStream` has to be used
instead.
In newer versions of Tokio `broadcast::Receiver` doesn't implement
`Stream`, so `tokio_stream::wrappers::BroadcastStream` instead. This
also requires changing the error type that is used.
Newer versions of Tokio can return an error if the semaphore is closed.
This shouldn't happen in `tower-batch` because the semaphore is never
closed.
On newer versions of Tokio `Semaphore::acquire` can return an error if
the semaphore is closed. This shouldn't happen in the test because the
semaphore is never closed.
Use versions compatible with Tokio version 1.
Use a version that supports Tokio version 1.
And also update the `metrics-exporter-prometheus` to version 0.6.1.
These updates are to make sure Tokio 1 is supported.
`u64` isn't supported as the histogram data type in newer versions of
`metrics`.
jvff and others added 11 commits November 2, 2021 00:31
Make it compatible with the new version of `metrics`.
Remove all constants and use the new `metrics::incement_counter!` macro.
The snapshot string isn't included in the newer version of
`metrics-exporter-prometheus`.
Use a version compatible with Tokio version 1.
This seems to not be available from `sentry-tracing` anymore, so it
needs to be replaced.
This seems like the replacement for `TracingIntegration`.
Suggested by a Clippy lint.
Apply all of the updates to dependencies.
Also ban git sources for tokio dependencies.
@teor2345 teor2345 force-pushed the single-tokio-version branch from fdbbb66 to b1e4146 Compare November 2, 2021 02:36
@teor2345 teor2345 requested a review from jvff November 2, 2021 02:37
@teor2345 teor2345 mentioned this pull request Nov 2, 2021
3 tasks
@teor2345 teor2345 marked this pull request as ready for review November 2, 2021 08:36
@jvff
Copy link
Contributor

jvff commented Nov 2, 2021

Merged through #2994.

@jvff jvff closed this Nov 2, 2021
@teor2345 teor2345 deleted the single-tokio-version branch March 21, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Dependency file updates C-enhancement Category: This is an improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants