Hi
I've written a .NET dll that contains a method that takes a number of seconds to complete. It contains a series of "QuerySelect queryObj = new QuerySelect();" statements among other things. I am finding that when a user calls that method and then another user calls another of my methods that the first user's process gets interrupted and cannot recover.
is this behavior expected? Do I have to disallow multiple users when running these long methods?
Below is an commented section from my .net log file.
User 1 invokes a .NET method RunCreateNewBatch - the dotnet objects get initialized followed by Invoking the method
Jun 8 2015 10:37:10.677 2548 2380 5 Type: CompoundEntryScreen.AppFactory, BaseClass: System.Object
Jun 8 2015 10:37:10.677 2548 2380 5 Is Class: True; Is AppFactory: True
Jun 8 2015 10:37:10.677 2548 2380 5 AppFactory found
Jun 8 2015 10:37:10.677 2548 2380 5 Invoking Method: RunCreateNewBatch; DLL: CompoundEntryScreen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Jun 8 2015 10:37:10.677 2548 2380 5 Casting the Method result to Sage.CRM.WebObject.Web
Jun 8 2015 10:37:10.677 2548 2380 5 Before invoke BuildContents
Jun 8 2015 10:37:10.755 2548 2380 5 TCrmWebObject.GetQuery FeWare.refCount = 1
Jun 8 2015 10:37:10.769 2548 2380 5 TCrmWebObject.GetQuery FeWare.refCount = 1
to this point user 1 has started the RunCreateNewBatch method and is well into the method with lots left to do
User 1's method at this point has executed the first of 5 sql statements in one of its routines and note that it's been 1.24 seconds since the last log entry
at this precise moment user 2 is coming to life by invoking the method RunBarcodeScreen
Jun 8 2015 10:37:12.000 2548 5128 5 Set WebPage object reference.
Jun 8 2015 10:37:12.000 2548 5128 5 Loading CRM Interfaces:
Jun 8 2015 10:37:12.001 2548 5128 5 LOADING MAIN INTERFACES
Jun 8 2015 10:37:12.003 2548 5128 5 Got assembly: CompoundEntryScreen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Jun 8 2015 10:37:12.005 2548 5128 5 EntryPoint - Initializing dotnet objects
Jun 8 2015 10:37:12.005 2548 5128 5 Type: CompoundEntryScreen.Properties.Settings, BaseClass: System.Configuration.ApplicationSettingsBase
Jun 8 2015 10:37:12.005 2548 5128 5 Is Class: True; Is AppFactory: False
.
.
. Many traces like this - one for each method - removed just to make reading reasier
.
Jun 8 2015 10:37:12.016 2548 5128 5 Type: CompoundEntryScreen.DeleteTemplateTask, BaseClass: Sage.CRM.WebObject.Web
Jun 8 2015 10:37:12.016 2548 5128 5 Is Class: True; Is AppFactory: False
Jun 8 2015 10:37:12.016 2548 5128 5 Type: CompoundEntryScreen.AppFactory, BaseClass: System.Object
Jun 8 2015 10:37:12.017 2548 5128 5 Is Class: True; Is AppFactory: True
Jun 8 2015 10:37:12.017 2548 5128 5 AppFactory found
and here is where user 2 is getting past the overhead and starting the method RunBarcodeScreen
Jun 8 2015 10:37:12.017 2548 5128 5 Invoking Method: RunBarcodeScreen; DLL: CompoundEntryScreen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Jun 8 2015 10:37:12.017 2548 5128 5 Casting the Method result to Sage.CRM.WebObject.Web
Jun 8 2015 10:37:12.017 2548 5128 5 Before invoke BuildContents
Jun 8 2015 10:37:12.082 2548 5128 5 Unloading Domain
Jun 8 2015 10:37:12.082 2548 5128 5 NET - BASE RELEASE CORE INTERFACES
Jun 8 2015 10:37:12.082 2548 5128 5 Metadata Unload.
Jun 8 2015 10:37:12.082 2548 5128 5 Keys Unload.
Jun 8 2015 10:37:12.082 2548 5128 5 UserSession Unload.
Jun 8 2015 10:37:12.082 2548 5128 5 Dispatch Unload.
Jun 8 2015 10:37:12.092 2548 5128 5 Unloading WebPage
at this point user2 is done and control is passed back to user 1 process but the stack seems to be corrupted
Jun 8 2015 10:37:12.563 2548 2380 1 Class: CRMWrapper - Method: ExecWebPageNew - Error: An error has occurred on PreBuildContents or BuildContents
Jun 8 2015 10:37:12.566 2548 2380 5 StackTrace:
Error: COM object that has been separated from its underlying RCW cannot be used.
Server stack trace:
at Sage.CRM.Wrapper.IeWareQuery.SelectSql()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Sage.CRM.Wrapper.IeWareQuery.SelectSql()
at Sage.CRM.Data.QuerySelect.ExecuteReader()
at CompoundEntryScreen.CreateNewBatch.UpdateExpectedPrices()
at CompoundEntryScreen.CreateNewBatch.BuildContents()
at Sage.CRM.Wrapper.CRMWrapper.ExecWebPageNew(String fullFileName, String callFunction)
Jun 8 2015 10:37:12.566 2548 2380 5 Unloading Domain
Jun 8 2015 10:37:12.566 2548 2380 5 NET - BASE RELEASE CORE INTERFACES
Jun 8 2015 10:37:12.566 2548 2380 5 Metadata Unload.
Jun 8 2015 10:37:12.566 2548 2380 5 Keys Unload.
Jun 8 2015 10:37:12.566 2548 2380 5 UserSession Unload.
Jun 8 2015 10:37:12.566 2548 2380 5 Dispatch Unload.
Jun 8 2015 10:37:12.571 2548 2380 5 Unloading WebPage