microsoft / Power-Fx

Power Fx low-code programming language
MIT License
3.21k stars 327 forks source link

Robustness checks, thread safety #1519

Open MikeStall opened 1 year ago

MikeStall commented 1 year ago

Robustness checks (#981) - Several potential races. Writing is single threaded. Reading is multi-threaded.

We have some existing tests (https://github.com/microsoft/Power-Fx/blob/main/src/tests/Microsoft.PowerFx.Core.Tests/ImmutabilityTests.cs) . Expanding that test shows a few suspicious things:

  1. DType.AssociatedDataSources returns mutable value
  2. DType.ExpandInfo returns mutable value (IExpandInfo.UpdateEntityInfo)
  3. DType.LazyTypeProvider returns mutable value (fixed in #1511)
  4. WrappedDerivedRecordType._renameDriver returns mutable value

We should also ensure these eval/runtime types are ThreadSafe. ParsedExpression Core.IR.Nodes.IntermediateNode ReadOnlySymbolValues ComposedReadOnlySymbolValues

MikeStall commented 1 year ago

See #1520 for new test to scan these failures.

Currently, there are about 100 failures, mostly false-positives. We should manually review determine if it is safe?