Terminating host leaves status in limbo

I have a long running workflow and I’m trying to simulate a failure to a hosting environment. When I terminate the host of the runtime, it seems that the status is not being updated before termination. When I query the database it always reports the status as “Running”. I was wondering if when the host crashes it’s possible to mark the workflows that are executing to be in suspended state until the host comes back online. My intention is to start the workflow back up and continue where it left off, but I can’t seem to get it in a suspend mode.

I’m using SqlWorkflowPersistenceService and SqlTrackingService and I am just ending the process via the Task Manager.



Answer this question

Terminating host leaves status in limbo

  • Carlos_SS

    Thanks. It is indeed working as you suggest.

    I was thrown off by the fact that my application (which implements a TrackingChannel/Tracking service) was not seeing any tracking events for these activities which are being reloaded on startup. But this seems to be a problem needing its own discussion thread.

  • Schtrudel

    What is the preferred method for a host to restore all persisted workflows, so that it can monitor them when it is restarted

    SqlWorkflowPersistenceService has the method LoadWorkflowInstanceState, but to use that you have to know the instanceID (guid). Is there some way to get a list of all instance IDs (for workflows that were active before the crash or shutdown)

  • abwebsvcs

    Given that you are ending the process, the runtime doesn't really have time to do anything to set up the status in the database. The whole idea is that you have crashed and the runtime can't do anything about it.

    However, after you start your runtime again, your workflow should be at the last persisted state before the crash. So, if it is waiting for an event or timer, it should recover when the event arrives or the timer expires. If you just need to run some more activities, try asking the runtime to load your workflow for you and it should start executing again.

    Matt



  • AnilYu

    As long as the instance is not marked as blocked, completed, suspended or terminated, then the persistence service should attempt to load it when it starts up in the new application instance.

    Check the blocked field in the instance state table as well as the status field. What values do you find there

    Matt



  • Terminating host leaves status in limbo