Skip to content

server: Enable tower util feature#1464

Merged
niklasad1 merged 1 commit intoparitytech:masterfrom
FabianLars:patch-1
Sep 26, 2024
Merged

server: Enable tower util feature#1464
niklasad1 merged 1 commit intoparitytech:masterfrom
FabianLars:patch-1

Conversation

@FabianLars
Copy link
Contributor

I don't see why it only started today but we got quite a lot of bug reports for this error message:

error[E0432]: unresolved import `tower::util`                                                                                                      
   --> A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\jsonrpsee-server-0.24.4\src\utils.rs:37:12
    |
37  | use tower::util::Oneshot;
    |            ^^^^ could not find `util` in `tower`
    |
note: found an item that was configured out
   --> A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tower-0.4.13\src\lib.rs:215:9
    |
215 | pub mod util;
    |         ^^^^
    = note: the item is gated behind the `util` feature

error[E0432]: unresolved import `tower::ServiceExt`
   --> A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\jsonrpsee-server-0.24.4\src\utils.rs:38:5
    |
38  | use tower::ServiceExt;
    |     ^^^^^^^----------
    |     |      |
    |     |      help: a similar name exists in the module: `Service`
    |     no `ServiceExt` in the root
    |
note: found an item that was configured out
   --> A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tower-0.4.13\src\lib.rs:223:34
    |
223 | pub use self::util::{service_fn, ServiceExt};
    |                                  ^^^^^^^^^^
    = note: the item is gated behind the `util` feature

error[E0599]: the method `graceful_shutdown` exists for struct `Pin<&mut UpgradeableConnection<'_, TokioIo<TcpStream>, TowerToHyperService<<... as Layer<...>>::Service>, ...>>`, but its trait bounds were not satisfied
    --> A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\jsonrpsee-server-0.24.4\src\server.rs:1233:19
     |
1233 |                 conn.as_mut().graceful_shutdown();
     |                               ^^^^^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
     |
    ::: A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-util-0.1.9\src\rt\tokio.rs:16:1
     |
16   | pub struct TokioExecutor {}
     | ------------------------ doesn't satisfy `_: HttpServerConnExec<TowerToHyperServiceFuture<<HttpMiddleware as Layer<TowerServiceNoHttp<RpcMiddleware>>>::Service, Request<Body>>, Body>`
     |
     = note: the full type name has been written to 'A:\_target\debug\deps\jsonrpsee_server-ab8a35524401df3d.long-type-10406918538042668016.txt'   
     = note: consider using `--verbose` to print the full type name to the console
     = note: the following trait bounds were not satisfied:
             `{type error}: Sized`
             which is required by `TokioExecutor: HttpServerConnExec<utils::TowerToHyperServiceFuture<<HttpMiddleware as Layer<TowerServiceNoHttp<RpcMiddleware>>>::Service, hyper::Request<jsonrpsee_core::http_helpers::Body>>, Body>`

error[E0599]: no method named `oneshot` found for type parameter `S` in the current scope
  --> A:\_packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\jsonrpsee-server-0.24.4\src\utils.rs:61:60
   |
51 | impl<S> hyper::service::Service<HttpRequest<hyper::body::Incoming>> for TowerToHyperService<S>
   |      - method `oneshot` not found for this type parameter
...
61 |         TowerToHyperServiceFuture { future: self.service.clone().oneshot(req) }
   |                                                                  ^^^^^^^ method not found in `S`

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `jsonrpsee-server` (lib) due to 4 previous errors

Enabling the feature seems to work (added tower with the feature to our direct deps for a quick test)

@FabianLars FabianLars requested a review from a team as a code owner September 25, 2024 21:01
@niklasad1
Copy link
Contributor

It's more interesting how it compiled at all before, hmm

@niklasad1 niklasad1 merged commit 1586d74 into paritytech:master Sep 26, 2024
@niklasad1
Copy link
Contributor

Released v0.24.5 with this fix, thanks for the PR

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.

2 participants