1

When I try to parse several ETL files in parallel via

 using (ITraceProcessor processor = TraceProcessor.Create(myEtlFile, new TraceProcessorSettings
 {
   AllowLostEvents = true,
 }))

I get this exception

System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used. The COM object was released while it was still in use on another thread.
Stack Trace: 
  InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 flags)
  AddInManagerAdapter.Create(String toolkitPath)
  ToolkitTraceProcessingEngine.Create(String path, ITraceProcessorSettings settings, ITraceProcessorSettings & effectiveSettings)
  TraceProcessor.Create(String path, ITraceProcessorSettings settings)

Is this a bug or a "known" limitation?

1 Answer 1

1

This is a known limitation. Given how the underlying native code interaction works, only one trace processor can be created at a time, unfortunately.

In general, TraceProcessor only supports single-threaded access, even for static methods. Some consumers have found places where multi-threaded code can work, but it's not tested/guaranteed - we generally haven't added locks or done anything to enable safe concurrent access.

2
  • Adding to that: the current best guidance is to create separate processes for each TraceProcessor. I.e. trace processing in parallel is possible, but not within a process.
    – Maiak
    May 22, 2020 at 20:03
  • Thanks! Then I will try the multiprocess approach. May 23, 2020 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.