shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

Introduce shuttle-ntex service

Open pavlospt opened this issue 1 year ago • 7 comments

Description of change

Adding service for Ntex web framework. https://ntex.rs

Closes #1708

pavlospt avatar Apr 01 '24 06:04 pavlospt

I added the tokio feature after getting a panic, but now I'm getting this when running the provided hello-world app:

# with patches applied
cargo r -p cargo-shuttle -- --wd examples/ntex/hello-world run

...

thread 'tokio-runtime-worker' panicked at /home/jonaro00/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntex-rt-0.4.12/src/lib.rs:192:9:
`spawn_local` called from outside of a `task::LocalSet`

Any idea how to solve it?

jonaro00 avatar Apr 02 '24 14:04 jonaro00

Will check it out:)

pavlospt avatar Apr 02 '24 14:04 pavlospt

I added the tokio feature after getting a panic, but now I'm getting this when running the provided hello-world app:

# with patches applied
cargo r -p cargo-shuttle -- --wd examples/ntex/hello-world run

...

thread 'tokio-runtime-worker' panicked at /home/jonaro00/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntex-rt-0.4.12/src/lib.rs:192:9:
`spawn_local` called from outside of a `task::LocalSet`

Any idea how to solve it?

is this script generating an examples folder? 🤔 I am trying it locally on my macOS MBP, and it doesnt seem to do so. It only generates the config.toml inside .cargo/ with the proper substitutions.

pavlospt avatar Apr 02 '24 15:04 pavlospt

I have found how to run the example and the same error is popping up for me too. I will probably open an issue on Ntex repo in order to have the authors' opinion!

pavlospt avatar Apr 02 '24 16:04 pavlospt

I copied the actix example and modified it ;) Thanks for investigating!

jonaro00 avatar Apr 02 '24 18:04 jonaro00

So apparently after opening an issue on Ntex to ask about the error, it seems that Ntex is more loosely coupled with Tokio, than Actix, which means it builds its own runtime based on the feature used. So at the moment the web-server is about to start the runtime of Ntex has not been created yet. https://github.com/ntex-rs/ntex/blob/master/ntex-rt/src/lib.rs#L170

This would probably mean that Ntex would require changes to allow it access to the current Runtime of Shuttle or something along these lines.

I have tried to open a PR towards that direction, but I am not sure if I am able to accomplish it, so this will be blocked unitl there is a certain solution from Ntex maintainers 😞

pavlospt avatar Apr 03 '24 07:04 pavlospt

@jonaro00 I have update to Ntex 0.4.13 which tries to "hook" on a Handle from Tokio if there is one, but apparently now I get build time errors due to not thread safe parts of Tokio being used. I unfortunately cannot debug this, even if I tried. Not so familiar with the language yet :/ Let me know if you have time to check it!

pavlospt avatar Apr 04 '24 17:04 pavlospt