Hi,
I have Dynamics 365 V8.2 on-premise and I have sometimes an error "New transaction is not allowed because there are other threads running in the session" inside an asyn plugin when its calling an action.
1. I have an custom action based on account entity which will call SAP api to send crm account info to SAP
2. I have an async plugin trigged by updating a custom entity and then, it will update the a field on account entity and then call action in step 1 to send updated account infomation to sap. but sometimes , this plugin failed to execute with an error "New transaction is not allowed because there are other threads running in the session", and this error was threw when calling the action. it is very strange for me. this problem happened serveral times daily, abount 15%-30%.
3. I have a workflow which call the action in step 1, when the pluign failed to send info to sap, I will run this workflow manually and this workflows always works well, without any error.
I have searched a lot and this error and I can not found any useful information. I have also add 3 times retry today but it does has 3 times failed with the same error.
Thank you.
Hi David,
Maybe your first point explains my problem. I found that I have put a static IOrganizationService outside the Execute Method.
I should put the instance of IOrganizationService inside the Execute method and pass as an parameter to another method. Am I right?
Thank you and I will try it.
There are a couple of things to check in your code:
Do you use the IOrganizationService instance that is derived from the IPluginExecutionContext for all calls to CRM ? If you use a different method to access CRM in your plugin, you could cause issues as this would be considered a new connection and new transaction. If possible, you should always use the IOrganizationService instance that is derived from the IPluginExecutionContext.
Do you make any calls to access or modify metadata in the plugin ? Metadata operations, especially when modifying metadata, run under a different SQL concurrency level, and this can cause issues. However, you normally get a different error in this scenario
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156