ntex-rs / ntex

framework for composable networking services
Apache License 2.0
2.03k stars 109 forks source link

Compilation error while upgrading from 2.7 to 2.8 #460

Open leon3s opened 20 hours ago

leon3s commented 20 hours ago

Im experiencing a compilation error while i tried to upgrade from ntex 2.7 to ntex 2.8:

error: queries overflow the depth limit!
 --> /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/alloc/src/raw_vec.rs:104:5
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`nanocld`)
  = note: query depth increased by 130 when computing layout of `ntex_util::future::MaybeDone<{async fn body of ntex_service::pipeline::Pipeline<&ntex::http::h2::service::PublishService<ntex::web::app_service::AppFactoryService<ntex::web::stack::WebMiddleware<ntex::web::middleware::logger::LoggerMiddleware<ntex::web::stack::WebMiddleware<nanocl_utils::ntex::middlewares::serialize_error::SerializeErrorMiddleware<ntex::web::stack::WebMiddleware<nanocl_utils::ntex::middlewares::versioning::VersioningMiddleware<ntex::web::stack::WebMiddleware<ntex_cors::CorsMiddleware<ntex::web::app_service::AppService<ntex::web::app::Filter<ntex::web::error_default::DefaultError>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>, ntex::web::error_default::DefaultError>, ntex::http::body::Body, ntex::http::h1::default::DefaultControlService>>::call<ntex_h2::message::Message

It seems to come from the middlewares, if i comment the cors middleware it's compile, and if i uncomment it it's still compile, it just fail the first time. But this workarround cannot be done in the CI, any idea how i can fix this ?

fafhrd91 commented 19 hours ago

as simplest solution you can add #![recursion_limit = "256"] to lib.rs or main.rs

I will check types

fafhrd91 commented 19 hours ago

could you poss full output of the compiler

leon3s commented 19 hours ago

This is only what i have:

error: queries overflow the depth limit! --> /home/ubuntu/.rustup/toolchains/1.82.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:104:5 104 pub const NEW: Self = Self::new(); ^^^^^^^^^^^^^^^^^^^
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`nanocld`)
= note: query depth increased by 130 when computing layout of `ntex_util::future::MaybeDone<{async fn body of ntex_service::pipeline::Pipeline<&ntex::http::h2::service::PublishService<ntex::web::app_service::AppFactoryService<ntex::web::stack::WebMiddleware<ntex::web::middleware::logger::LoggerMiddleware<ntex::web::stack::WebMiddleware<nanocl_utils::ntex::middlewares::serialize_error::SerializeErrorMiddleware<ntex::web::stack::WebMiddleware<nanocl_utils::ntex::middlewares::versioning::VersioningMiddleware<ntex::web::stack::WebMiddleware<ntex_cors::CorsMiddleware<ntex::web::app_service::AppService<ntex::web::app::Filter<ntex::web::error_default::DefaultError>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>>, ntex::web::error_default::DefaultError>, ntex::web::error_default::DefaultError>, ntex::http::body::Body, ntex::http::h1::default::DefaultControlService>>::call<ntex_h2::message::Message>()}>`

error: could not compile nanocld (bin "nanocld") due to 1 previous error

Maybe it's a rust bug ? because as i said im able to make the same code compile by just commenting and uncommenting one line..

fafhrd91 commented 19 hours ago

could you try different version of rust?

leon3s commented 19 hours ago

i tried with 1.78, 1.79, 1.80, 1.81 and 1.82 and i still have the issue. I cannot go lower then 1.78 as the latest version of diesel request 1.78 or more.

fafhrd91 commented 18 hours ago

what project are you trying to build?

leon3s commented 18 hours ago

My project nanocl

leon3s commented 18 hours ago

I can probably create a repository to reproduce the problem

leon3s commented 18 hours ago

I was able to reproduce it with on this small repository:

https://github.com/leon3s/ntex-compile-error

leon3s commented 18 hours ago

And this is the code of my middlewares: https://github.com/next-hat/nanocl/tree/nightly/crates/nanocl_utils/src/ntex/middlewares

But i dont do anything crazy with the types