Memory leak when using Workflow 4.0 SqlWorkflowInstanceStore and PersistableIdleAction.Unload

This particular problem is driving me crazy. I wonder if anyone came across a similar problem. If I load a workflow, then unload it and take a snapshot, the result is predictable — my workflow is no longer in memory. However, if I load the workflow and set the PersistableIdle action to PersistableIdleAction.Unload and let the workflow idle, the workflow stays in memory even if the Unload action is triggered.

I used ANTS Memory Profiler to fix this issue. This is a plotted object persistence graph showing the inner object hanging on my workflow instance.

alt text
(source: rohland.co.za )

Can anyone else check this issue? My code is as follows:

  1. Create a SqlWorkflowInstanceStore and set up the handle of the lock owner
    - At this point I take a snapshot
  2. Create an instance of Workflow1
  3. Set action PersistableIdle
  4. Apply Instance Store to Workflow1
  5. Setting up action event handlers for Idle, Unload, UnhandledException, etc.
  6. Save an instance of a workflow
  7. Start a workflow instance
  8. Waiting, e.g. for idle (caused by delay activity)
  9. Make sure the Unload action is running
    - At this point I am taking a second snapshot

It is clear from the above image that the only object referencing Workflow1 is the result of some internal event handlers that I cannot dispose of.

Any hints?

+2


a source to share


1 answer


Seems like an interesting bug? I don't have the profiler you mentioned, so a couple of questions.



  • Is your research related to some significant memory use problems?

  • How sure are you that the offload action is actually completed during profiling (vs should happen asynchronously, etc.)?

  • The asynchronous chaining seems to be fine, but the TdsParserStateObject is likely to leak the real object. I notice that the class has a Dispose () method but does not implement IDisposable. So another idea is that Dispose () is used to manually "reset" or "recirculate" an object at some point in time, but that point in time turns out to be "not yet (unload time) but later", for example lazy disposal. Does your profiler allow you to see if the number of TdsParserStateObjects increases over time, to indicate a real leak? As opposed to "just a finite number of objects, not leaks leaks."

0


a source







All Articles