aws / aws-xray-sdk-dotnet

The official AWS X-Ray SDK for .NET.
Apache License 2.0
109 stars 64 forks source link

Potential Race Condition found by InferSharp static analysis tool #280

Open udlose opened 1 year ago

udlose commented 1 year ago

I am using AWSXRayRecorder v2.13.0 in my .NET 7 API. I am using the new Microsoft Static Analysis Tool (InferSharp) to analyze my code as well as dependent packages and I found a warning about a potential race condition:

0

/_/sdk/src/Core/Internal/Entities/Entity.cs:493: warning: Thread Safety Violation Read/Write race. Non-private method Entity.AddSubsegment(...) indirectly reads without synchronization from this.Amazon.XRay.Recorder.Core.Internal.Entities.Entity.<IsInProgress>k__BackingField. Potentially races with write in method Entity.set_IsInProgress(...). Reporting because this access may occur on a background thread.