I also want to add a comment based on previous experiences. The following scenarios:
- Session and / or engine and / or package are stored in static variables
- Session and / or engine and / or packet are sent as a parameter to the Static method
There may be several problems besides those described earlier, including memory leaks during publication.
The publisher will start consuming memory to the end in non-responsive mode (you cannot stop, restart, or shut down), and you need to restart the server.
These problems can go from bad to worse by mass publishing.
Therefore, it is recommended that everything that uses the session, engine, package package should be converted to non-static
As an example, let's move on to the following code used to initialize the Utilities used in all templates.
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using System.Xml; using Tridion; using Tridion.ContentManager; using Tridion.ContentManager.CommunicationManagement; using Tridion.ContentManager.ContentManagement; using Tridion.ContentManager.ContentManagement.Fields; using Tridion.ContentManager.Templating; using Tridion.ContentManager.Publishing; namespace sample.sample1 { public class Utilities { private static Engine _engine; private static Package _package; public void InitializeUtilities(Engine e, Package p) { _engine = e; _package = p; } } }
in
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using System.Xml; using Tridion; using Tridion.ContentManager; using Tridion.ContentManager.CommunicationManagement; using Tridion.ContentManager.ContentManagement; using Tridion.ContentManager.ContentManagement.Fields; using Tridion.ContentManager.Templating; using Tridion.ContentManager.Publishing; namespace sample.sample1 { public class Utilities { private Engine _engine; private Package _package; public void InitializeUtilities(Engine e, Package p) { _engine = e; _package = p; } } }
You can save a lot of problems.
Miguel
source share