Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Kentico creating mulplies documents. View modes: 
User avatar
Member
Member
Leandro Brito - 5/10/2012 12:44:21 PM
   
Kentico creating mulplies documents.
Hi,

When I create a news document sometimes the kentico multiplies the document creating 3-5 copies thereof.

The server has a webfarm and the configuration sincronization is the default.

Does anyone help me?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/10/2012 2:20:06 PM
   
RE:Kentico creating mulplies documents.
Hi,

I have never seen this behavior in standard CMS installation. Are you using any customizations or are you creating the documents using API?
Could you please describe your exact setup and steps how to reproduce this issue?

Best regards,
Juraj Ondrus

User avatar
Member
Member
Leandro Brito - 5/11/2012 7:19:41 AM
   
RE:Kentico creating mulplies documents.
Hi Juraj,

Yes, we have customizations in CustomEventHandler fired by OnBeforeInsert and OnBeforeUpdate. Basically the customization open a xml file with keywords and url's and use REGEX to replace the words for links, for example:

<xml>
<key>dog</key>
<url>www.dog.com.br</url>
</xml>


If the news document text has the word dog, it is changed by a link with <a href="www.dog.com.br">dog</a>

Maybe the problem can be the size of xml, actually 9.28 MB, it is doing the save process slow.

The steps are simple, create the news, fill the fields and saved.

Thanks!
Leandro Brito

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/11/2012 10:33:40 PM
   
RE:Kentico creating mulplies documents.
Hi,

Do you see anything weird when you run your code in the debug mode? How many times is the code executed? Are the values correct?

Best regards,
Juraj Ondrus

User avatar
Member
Member
Leandro Brito - 5/14/2012 8:09:51 AM
   
RE:Kentico creating mulplies documents.
Hi Juraj,

I found a little problem in the CustomEventHandler but I don't know if this this can cause duplication of documents..

There is other customization related a change of templates, so the method do a node.Update() and it trigger the "keywords code" again. The flow on debug is:

Page->Event->CustomCode

1. CustomTreeNodeHandler -> OnBeforeInsert() -> KeyWords Code
2. CustomTreeNodeHandler -> OnAfterInsert() -> ChangeTemplate (do a update())
3. CustomTreeNodeHandler -> OnBeforeUpdate() -> KeyWords Code
4. CustomDataHandler -> OnBeforeInsert() -> Create Alias for Document (do a setObject())
5. CustomTreeNodeHandler -> OnBeforeUpdate() -> KeyWords Code


Exists some way to do a flag for the document to execute the code only one time? I try ViewState but unsuccessfully.

Even repeating the words the problem did not happen in the area of development. Do you think that problem is not related with WebFarm?

Thanks for the help!
Best regards,

Leandro Brito

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/16/2012 10:59:49 AM
   
RE:Kentico creating mulplies documents.
Hi,

I am sorry but it does not make much sense to me - I do not know your code so it is hard to say. When you go through the code line by line - is there at any moment created new document? It should be logged in the Event log as well as yu should see the node in the content tree in CMS Desk (e.g. debug site is launched in one browser whereas you will check it in another browser without debug).

Best regards,
Juraj Ondrus