In certain cases, NT8 B11 is causing a full crash of the application during the loading process of the Market analyzer with the following stack trace:
2016-06-10 13:04:56:774 *************** unhandled exception trapped ***************
2016-06-10 13:04:56:774 The process cannot access the file 'C:\Users\Shawn Donahue\Documents\NinjaTrader 8\db\minute\USDJPY\20160610.Last.ncd' because it is being used by another process.
2016-06-10 13:04:56:775 System.IO.IOException: The process cannot access the file 'C:\Users\Shawn Donahue\Documents\NinjaTrader 8\db\minute\USDJPY\20160610.Last.ncd' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at NinjaTrader.Data.BarsSeries.Save()
at NinjaTrader.Cbi.Instrument.<>c__DisplayClass197_0. <RequestBars>b__1(Object o)
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System. Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
The problem is clearly a threading access violation issue. However, there is nothing in the code for the custom MA columns that I can correlate with being responsible for this since I am obviously not doing anything to directly access the file in question.
The MA is a simple MA displaying the Forex pairs from the FOREX instrument list and 3 custom columns. Can you think of anything within an MA column which could potentially cause this to happen? Currently, I do some initialization (all on the same thread) within OnStateChange on State == Historical, and in so doing, I had to do a lock around the code block since it appears that the same background thread was handling more than one cell resulting in unpredictable state and behavior. Other than that, everything is pretty standard with no additional locking, no dispatcher invocation or additional threading.
Is there a different or more reliable state in which to perform this? I am suspecting that this may have something to do with it.
The main requirement for the initialization is that I need to have an initialized Bars object to pass to an internal data adapter for calculation and processing.
Thanks!
Comment