-
Notifications
You must be signed in to change notification settings - Fork 700
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
Add/remove routes at runtime #1100
Comments
The same problem like you i used the API Routes::Remove but i still access to the server after removing routes in many use case the application crash due an issue of bind ... |
I'm pretty sure that's still not thread safe, it still just calls the methods on Router / Private::RouterHandler, so you'll run in to issues unless you're very careful. I'm not entirely sure if my wrappers are fully thread-safe, but they seem okay so far. |
I've not looked at the code, but I suspect that you are correct. Adding and removing routes is likely not thread safe; it should take a writer lock on the routing table, and doing route lookups should take a reader lock. This locking is likely non-existent. You can probably verify this with |
I started writing a thread-safe wrapper for Router / Private::RouterHandler to support adding and removing routes dynamically, when I saw in the RouterHandler comments:
I wondered how this might be done safely, once the server is running? Can it only be done when processing a request on a single-threaded server?
The text was updated successfully, but these errors were encountered: