Hi,
it seems that actual problem was cache load without locking: CacheLoadingThread calls updateDciCache on every node, which in turn calls updateCacheSize on every DCI, and there was no lock on DCI level inside, so any access to DCI at that moment may cause unpredictable results. And because you have NXSL scripts accessing DCI data running at same moment as well as templates removal it happens. I've changed cache loading to use proper locks on DCIs, that should solve this issue (changes already pushed to develop and stable-2.0 branches).
Btw, you could avoid template unbinding on startup by checking return value of GetDCIValue function for being null aborting auto-apply script (using abort statement) - system will make no change in current binding status if script completes with runtime error.
Best regards,
Victor
it seems that actual problem was cache load without locking: CacheLoadingThread calls updateDciCache on every node, which in turn calls updateCacheSize on every DCI, and there was no lock on DCI level inside, so any access to DCI at that moment may cause unpredictable results. And because you have NXSL scripts accessing DCI data running at same moment as well as templates removal it happens. I've changed cache loading to use proper locks on DCIs, that should solve this issue (changes already pushed to develop and stable-2.0 branches).
Btw, you could avoid template unbinding on startup by checking return value of GetDCIValue function for being null aborting auto-apply script (using abort statement) - system will make no change in current binding status if script completes with runtime error.
Best regards,
Victor