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

Introduce shuttle-ntex service #1707

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pavlospt
Copy link

@pavlospt pavlospt commented Apr 1, 2024

Description of change

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

Closes #1708

@pavlospt pavlospt force-pushed the chore/add-shuttle-ntex-service branch 6 times, most recently from 15afbd1 to bfe59f1 Compare April 1, 2024 07:17
Copy link
Member

@jonaro00 jonaro00 left a comment

Choose a reason for hiding this comment

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

Looks good. Will test it out!

@pavlospt pavlospt force-pushed the chore/add-shuttle-ntex-service branch 2 times, most recently from bbb8beb to da887c7 Compare April 2, 2024 12:27
@pavlospt pavlospt requested a review from jonaro00 April 2, 2024 12:44
@jonaro00
Copy link
Member

jonaro00 commented Apr 2, 2024

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?

@pavlospt
Copy link
Author

pavlospt commented Apr 2, 2024

Will check it out:)

@pavlospt
Copy link
Author

pavlospt commented Apr 2, 2024

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
Copy link
Author

pavlospt commented Apr 2, 2024

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!

@jonaro00
Copy link
Member

jonaro00 commented Apr 2, 2024

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

@pavlospt pavlospt force-pushed the chore/add-shuttle-ntex-service branch 2 times, most recently from 377f09f to 13cdadc Compare April 2, 2024 19:24
@pavlospt
Copy link
Author

pavlospt commented Apr 3, 2024

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 pavlospt force-pushed the chore/add-shuttle-ntex-service branch from f8e5a4d to 932d514 Compare April 4, 2024 16:52
@pavlospt pavlospt force-pushed the chore/add-shuttle-ntex-service branch from 18aeb05 to be2612e Compare April 4, 2024 17:19
@pavlospt
Copy link
Author

pavlospt commented Apr 4, 2024

@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!

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.

[Feature]: Introduce Ntex web framework Service
2 participants