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

How to unmap a previously mapped OData service route completely #2773

Open
RainerAtSiemens opened this issue Apr 13, 2023 · 1 comment
Open
Assignees

Comments

@RainerAtSiemens
Copy link

Issue

In out product we are using the method Microsoft.AspNet.OData.Extensions.HttpConfigurationExtensions.MapODataServiceRoute(this HttpConfiguration configuration, string routeName, string routePrefix, Action configureAction) to map our OData service routes.

We have some static routes and some dynamic ones. For the dynamic ones, we need to be able to "unmap" a route which was previously added. My question is how can I do that unmapping in a clean way without having any memory leak.

Assemblies affected

Microsoft.AspNet.OData.dll v7.5.12

Reproduce steps

  1. Check entries of HttpConfiguration.Routes and HttpConfiguration.Properties
  2. Map a odata route using Microsoft.AspNet.OData.Extensions.HttpConfigurationExtensions.MapODataServiceRoute(this HttpConfiguration configuration, string routeName, string routePrefix, Action configureAction)
  3. Check entries of HttpConfiguration.Routes and HttpConfiguration.Properties -> should have some added entries
  4. Unmap the OData route. Not sure what is the best way to do. Currently we just do HttpConfiguration.Routes.Remove(routName) but that does not unmap everything so some references are still there, e.g. to the created ODataRootContainer.
  5. Check entries of HttpConfiguration.Routes and HttpConfiguration.Properties -> should have some entries like in 1., i.e. no memory leak

Expected result

When a route is mapped and unmapped, there should not be a increase in memory.

Actual result

When there is no way to unmap a route completley, there is a memory leak.

@habbes
Copy link
Contributor

habbes commented Apr 19, 2023

I don't think we explicitly support "unmapping" a route. Maybe that would required manually removing everything that was added as a result of the route, not sure how practical that is. This sounds like a feature request. @xuzhg could you take a look?

@habbes habbes added the P3 label Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants