I seem to be having problems with Ditto & Umbraco and Rich Text Editor internal links. It seems whenever there is a link to the homepage of the site, umbraco is getting into infite loop and throwing a StackOverflowException.
Stack trace:
I tried a few version of ditto. The above screenshot is from 0.4.1. In version 0.5.0 the same bug is killing the application pool.
Just wondering if any of you experienced this problem?
Yes, we've enountered a similar situation and as a temporary fix, we removed the DittoPublishedContentModelFactory, and set a default controller (and subsequent hijack controllers) to use Ditto to create the models at that point. (There seems to be some sort of issue in Umbraco such that when using the model factory, models for all nodes in the path from the home to the desired node are all inflated).
Yup, there's a massive issue with Ditto and the ModelFactory implementation. :-( Currently I have no resolution for it, (I'm totally open to suggestions/contributions).
I don't think it is an issue with Ditto at all. I did try at least one different mapper and the same exception was thrown. I did come up with a workaround in v 0.4.1, but it requires calling Umbraco.Web.Templates.TemplateUtilities.ParseInternalLink in your views.
Do you think it would be worth getting one of the Core devs involved in this topic?
I still think it is a Ditto problem, as all Umbraco core is doing is calling CreateModel which is then calling Ditto's ModelFactory to convert it. I'm not sure what else Umbraco core can do about it. I know that Stephan is looking into this.
Have a read over these other topics, they hit the same issue with Ditto's ModelFactory too:
@Lee: would love to understand what Ditto is doing that the factory does not like. Obviously, creating a Ditto model seems to be somewhat reentrant, ie it will create other models, and eventually ends up creating the original model again, which is something that the Factory indeed does not like at all. I'm wondering to which extent it is a corner-case, or whether it would be interesting to refactor the Factory to handle such situation in a better way (it can be done, just need to track the graph of created models and break when trying to create a model we're already creating).
Another thing of interest to me: with the NuCache, which caches the IPublishedContent objects... if there's a Factory installed, then the cache would cache the models themselves, so that the creation of the model only happens once and not on every request. This has some consequences on models, ie they should be standalone things that should not contain references to other models (but only eg identifiers of other contents). From what I understand of the stack overflow issue... I'm wondering whether Ditto models would fit at all?
Dunno if you're at the retreat? But would really love spending a couple of hours discussing "modeling at large" ;-)
@Stephan - yes, let's talk at CG15, (and at the retreat too)! When I try to explain the issue/scenario I get confused with the explanation - so will be better to go through code examples together (and/or with others too).
(I've deleted what I've written in this reply a couple of times already, as it's too confusing - haha)
System.StackOverflowException
Hi All,
I seem to be having problems with Ditto & Umbraco and Rich Text Editor internal links. It seems whenever there is a link to the homepage of the site, umbraco is getting into infite loop and throwing a StackOverflowException.
Stack trace:
I tried a few version of ditto. The above screenshot is from 0.4.1. In version 0.5.0 the same bug is killing the application pool.
Just wondering if any of you experienced this problem?
Many thanks,
M
Hi,
Yes, we've enountered a similar situation and as a temporary fix, we removed the DittoPublishedContentModelFactory, and set a default controller (and subsequent hijack controllers) to use Ditto to create the models at that point. (There seems to be some sort of issue in Umbraco such that when using the model factory, models for all nodes in the path from the home to the desired node are all inflated).
HTH,
Hendy
Yup, there's a massive issue with Ditto and the ModelFactory implementation. :-( Currently I have no resolution for it, (I'm totally open to suggestions/contributions).
Cheers,
- Lee
I don't think it is an issue with Ditto at all. I did try at least one different mapper and the same exception was thrown. I did come up with a workaround in v 0.4.1, but it requires calling Umbraco.Web.Templates.TemplateUtilities.ParseInternalLink in your views.
Do you think it would be worth getting one of the Core devs involved in this topic?
Cheers,
Maciej
Hi Maciej,
I still think it is a Ditto problem, as all Umbraco core is doing is calling
CreateModel
which is then calling Ditto's ModelFactory to convert it. I'm not sure what else Umbraco core can do about it. I know that Stephan is looking into this.Have a read over these other topics, they hit the same issue with Ditto's ModelFactory too:
https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/61167-IPublishedContentModelFactory-and-a-Contentpicker-PropertyValueConverter
https://our.umbraco.org/projects/developer-tools/ditto/ditto-feedback/57167-BaseController-BaseViewModel-with-Hijacked-controllers
Cheers,
- Lee
Hi Lee,
Thanks for all the comments.
What way would you recommend to get around this issue?
Thanks, Maciej
Hi Maciej,
In all honesty I would recommend not using the
DittoPublishedContentModelFactory
at all.If you do want to use the ModelFactory approach, then go with Zbu.ModelsBuilder.
Cheers,
- Lee
@Lee: would love to understand what Ditto is doing that the factory does not like. Obviously, creating a Ditto model seems to be somewhat reentrant, ie it will create other models, and eventually ends up creating the original model again, which is something that the Factory indeed does not like at all. I'm wondering to which extent it is a corner-case, or whether it would be interesting to refactor the Factory to handle such situation in a better way (it can be done, just need to track the graph of created models and break when trying to create a model we're already creating).
Another thing of interest to me: with the NuCache, which caches the IPublishedContent objects... if there's a Factory installed, then the cache would cache the models themselves, so that the creation of the model only happens once and not on every request. This has some consequences on models, ie they should be standalone things that should not contain references to other models (but only eg identifiers of other contents). From what I understand of the stack overflow issue... I'm wondering whether Ditto models would fit at all?
Dunno if you're at the retreat? But would really love spending a couple of hours discussing "modeling at large" ;-)
@Stephan - yes, let's talk at CG15, (and at the retreat too)! When I try to explain the issue/scenario I get confused with the explanation - so will be better to go through code examples together (and/or with others too).
(I've deleted what I've written in this reply a couple of times already, as it's too confusing - haha)
Cheers,
- Lee
You can experiment with NuCache already. The source code is available here: https://github.com/umbraco/Umbraco-CMS/tree/dev-v7-contentcache
In this video I explain how I've upgraded a project to NuCache: https://youtu.be/DWjbJiIUQdk?t=31m8s
The project can be found here: https://our.umbraco.org/projects/developer-tools/1-1-multilingual-example/
Jeroen
is working on a reply...