0

Publisher service is getting crash while publishing certain type of components. This type of components fetch data from external oracle database .This is happening while we try to publish multiple component if we publish single component then publishing works well.below is error in event viewer of CMS server

Application: TcmPublisher.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean, Boolean, System.Data.CommandBehavior)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader()
   at Tridion.Extensions.ContentManager.Templating.OracleBI.GetData(System.String)

Here is templete code

public override void Transform(Engine engine, Package package)
        {
            OracleConnection connection = new OracleConnection();
            try
            {
                Initialize(engine, package); // Intializing Tridion Engine
                string connectionString = getSystemConfiguration(engine.PublishingContext.PublicationTarget.Title + ".OracleConnectionString", pub);

                //Oracle Command
                OracleCommand command = new OracleCommand("", connection);
                connection.ConnectionString = connectionString;
                try
                {
                    connection.Open(); //Opening the oracle database connection
                }
                catch
                {
                    throw new Exception("Could not connect to database for reading oracle Data.");
                }

                //Here is long code for reading data and processing data
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                    connection.Close();//closing the database connection 
            }
        }
3
  • 1
    Sounds like your template code is not thread safe, could you edit the question and provide perhaps some more detail on the actual template code which is failing? If you are unsure where exactly it is failing, maybe writing some logging statements around that code would help, so you can trace in the log where it stops. Another option would be to run the publusher in debug mode, but that probabaly is more work to setup. Aug 11, 2016 at 14:23
  • Also note that the access violation occurs in the Oracle client code which is invoked directly from templating code... Smells like direct DB access (which is not supported)... Aug 12, 2016 at 17:50
  • The same code was working absolutely fine with Tridion 2013 SP1 after upgrading to web 8 we are having this issue. Aug 13, 2016 at 11:12

2 Answers 2

1

Inside one of the utility class oracle command object was declared as static that was causing problem after removing static the problem get resolved.

0

Well, it would look like your issue is more Oracle related than Tridion (though arguably the Publisher should not crash, and instead should just cancel that transaction, something you could probably prevent by wrapping your failing code in proper exception handling).

Maybe this question/answer helps: https://stackoverflow.com/questions/16573614/attempted-to-read-or-write-protected-memory-in-a-net-application

Extending my answer a bit:

The only difference between single-item publishing and multiple items is concurrency: the template will execute in multiple threads simultaneously, which will increase risks. Apparently something is happening in this scenario that Oracle is not happy about, maybe concurrent access to a library or object that doesn't support it, or perhaps access to a locked record in Oracle?

1
  • i m having try and catch around the code but instead of throwing exception it is crashing publisher service Aug 14, 2016 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.