UiPath / CoreWF

WF runtime ported to work on .NET 6
MIT License
1.15k stars 218 forks source link

do not require same sync context for compilation #331

Closed AndreiSingeorzan closed 4 months ago

AndreiSingeorzan commented 4 months ago

The deadlock is caused by:

  1. Thread A uses the model item in whatever way, so it locks it
  2. There's a Task.Run with VisualBasicDesignerHelper.CreatePrecompiledValueAsync().Result in WorkflowDesigner => Thread B
  3. Thread B will eventually do FindVariable, which enumerates the model item, so tries to lock again => DEADLOCK

This PR will be followed by another PR in WorkflowDesigner, which does not use Task.Run anymore, for this compilation, so the flow will be:

  1. Thread A locks the model item
  2. Thread A does VisualBasicDesignerHelper.CreatePrecompiledValueAsync().Result
  3. Thread A does FindVariable (it will be able to recursively acquire the lock)
  4. Thread A does await GetAllDiagnosticsAsync(), which needs ConfigureAwait(false) (as the thread will be blocked at the earlier .Result now)

https://uipath.atlassian.net/browse/STUD-70986

github-actions[bot] commented 4 months ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.