rwf2 / Rocket

A web framework for Rust.
https://rocket.rs
Other
24.55k stars 1.57k forks source link

Rocket shows route conflicting with itself and multiple times over #1101

Closed luciusmagn closed 4 years ago

luciusmagn commented 5 years ago

Hi, I am not sure if this is a bug or if I have done something wrong, but I am encountering an issue where if I get a conflict in the app I am working on, it shows the route conflicting with itself, rather than the route it actually conflicts with, which hinders my debugging ability.

Also for some reason, whenever I create any conflict, I will additionally get a message about the index route / conflicting with itself as well, multiple times as well.

I am not sure what's the cause, but to provide context, I am running on regular x64 Arch, Rocket v4.2, and the application I am working on is fairly large (160-ish routes).

Here's a screenshot of the issue: Screenshot

Thanks in advance for info!

jebrosen commented 5 years ago

Can you post a reproducible example, or at the very least the routes you have mount()ed? I suspect you have legitimately duplicated routes, possibly routes that were meant to be mounted with .mount("/prefix", routes).

luciusmagn commented 5 years ago

Hi, thanks for the lightning fast response.

Sure thing, I can post routes and some info.

In this gist, I've included the declarations of all the routes I have mounted (I have a set of macros which handles the fact that I run each set of routes as their own processes, it basically just generates IPC shells), along with my init function, where I mount all of the routes. I started this app at around Rocket 0.3.9, so apologies, if I am a bit behind on the latest Rocket tech, although I am actually running at 0.4.2.

the gist

And here's the complete output of running the server, both in text and color:

text

color

jebrosen commented 5 years ago

If you look closely at the output, you can see two groups of "task" endpoints being mounted. Matching that up the the code in init.rs, it looks like the roles endpoints are incorrectly being put under /<instanceid>/task instead of /<instanceid>/role.

Hopefully that makes it easier to track down -- I don't think I would be able to figure out more detail than that without knowing how reapi or reutils work, and that routes! { } macro is very unfamiliar to me.

luciusmagn commented 5 years ago

Yep, that fixed it, haha. I had a bad copy-pasta import in one place.

The routes! { } macro is just a utility which generates some boilerplate for IPC with actual implementations of the routes, doesn't do much.

Thanks a lot for the help, you guys do an A+ framework with A+ support!

I'm still a bit perplexed about the several GET / collides with GET /, as they disappeared once the other issue was fixed...

jebrosen commented 5 years ago

I'm still a bit perplexed about the several GET / collides with GET /, as they disappeared once the other issue was fixed...

I'm confused too - I don't see those being mounted anyway. Maybe it's a bug in the collision detection or reporting code.

jebrosen commented 4 years ago

I can't reproduce the GET / collides with GET /, so I'm going to close this issue. Please feel free to reopen if this issue appears again.