-
Notifications
You must be signed in to change notification settings - Fork 2.1k
TryUpdateModelAsync Out of Memory error #2799
Comments
Could you post a more complete sample of your entity classes so we can investigate? |
|
Thanks, I'm looking into trying to reproduce the OOM issue. We definitely have a bug here and that shouldn't be happening. A few thoughts in the meantime: Using There are a few mitigations for this, but using ViewModels provides the most flexibility. http://stackoverflow.com/questions/11064316/what-is-viewmodel-in-mvc By the same coin, validation is going to traverse your entire EF model and attempt to validate every entity - hence the number of levels of |
Thanks for the suggestions, agreed that ViewModels are the right way to do it, code is mostly from quick and dirty admin pages where we were too lazy to create Models. I hand't realize that it would try to validate all of the child entities, but that makes sense. |
I thought a bit more about your suggestion and I don't think using ViewModels helps, I tried a quick test and am seeing the same behavior using a ViewModel. I'm thinking the validation occurs on the entity you are trying to update which is the domain entity still with all of its related children.
|
That's absolutely correct. If you're just using |
yes, we do use AutoMapper already to populate ViewModels, I've just always used TryUpdateModel to update the EF entity, I thought that was the primary use case of that method? |
|
The change here is that when we create the ModelValidationNodes to just return them rather than adding them to the tree. For a very large model, having these extra nodes in the tree would eventually cause an OOM. We're going to be taking a more thorough look at this code separately, hence the quick fix.
The change here is that when we create the ModelValidationNodes to just return them rather than adding them to the tree. For a very large model, having these extra nodes in the tree would eventually cause an OOM. We're going to be taking a more thorough look at this code separately, hence the quick fix.
when calling TryUpdateModelAsync on most(not all) of the entitys in my domain i get an out of memory error. IIS Express seems to loop endlessly until it runs out of memory. This problem started happening in Beta 4, I just updated to Beta 5 and I'm still seeing the same behavior. Domain is about 50 entities.
Here is an example of controller Action.
here is the Error:
The text was updated successfully, but these errors were encountered: