locked
SerializationException when the workflow instance is Resumed RRS feed

  • Question

  • Hi All,

        I have two systems hosting two different WF runtimes. I need to execute a sequential WF consisting of two activities A and B. Activity A would run on one system and B on a different system.

    I have done the following to realize this. After Activity A runs on the first system, the workflow is suspended using a Suspend Activity and the WF instance persisted using SqlPersistenceService. I pass the instance ID (Guid) to the second system (via Remoting) and I try to resume the WF using the following statement

    WorkflowInstance workflowInstance = workflowRuntime.GetWorkflow(new Guid(workflowInstanceID));

    workflowInstance.Resume();

    However the first statement results in the following exception

    "The object with ID 18 implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other."

    I have identifical assemblies on both the systems. The WF hasn't been changed since its persistence and retrieval. The same codebase works on a single system, but fails when it runs on two systems

    Can anyone help me out here

    Rgds

    Giri

     

     

    Thursday, September 21, 2006 8:47 AM

Answers

  • Giri,

    Persistence service tries to resume any previously saved and unblocked instances on the host startup. If these instances are of some different version then deserialization fails. It looks like there is some  WF instance in your DB other than the one which was running on system1. When runtime on system2 tries to load and resume it, it can't find the correct assembly and result in the serialization error. Check your instancestate table before starting host on system2. Can you verify, this table has only one workflow instance and it is of the workflow that was running on system1?

    Suspend activity suspends the workflow in memory but does not persist or unload it from the memory. Are you making sure that workflow on system1 is persisted and unloaded after Activity A completes? If you want to resume worflow on a different system, workflow execution must stop after activity A, the instance must persist and unload from system1 and it should be marked as unlocked in the persistence database. Workflow runtime on system2 should point to this database to load and resume it. From the your description it seems you are trying to achieve the multiple host scenario where a single workflow can run on multiple machines. Just to confirm a few things,  are you setting ownershiptimeout in the ctor of sqlworkflowpersistenceservice on both the systems? Are both the systems pointing to the same persistence store? You can find some information about multiple host scenario and instance locking concepts here .

    Let me know if this helps to solve your problem. If not please give some more details about your scenario.

    -Sonali

     

    Thursday, November 30, 2006 6:12 AM

All replies

  • Giri,

    Persistence service tries to resume any previously saved and unblocked instances on the host startup. If these instances are of some different version then deserialization fails. It looks like there is some  WF instance in your DB other than the one which was running on system1. When runtime on system2 tries to load and resume it, it can't find the correct assembly and result in the serialization error. Check your instancestate table before starting host on system2. Can you verify, this table has only one workflow instance and it is of the workflow that was running on system1?

    Suspend activity suspends the workflow in memory but does not persist or unload it from the memory. Are you making sure that workflow on system1 is persisted and unloaded after Activity A completes? If you want to resume worflow on a different system, workflow execution must stop after activity A, the instance must persist and unload from system1 and it should be marked as unlocked in the persistence database. Workflow runtime on system2 should point to this database to load and resume it. From the your description it seems you are trying to achieve the multiple host scenario where a single workflow can run on multiple machines. Just to confirm a few things,  are you setting ownershiptimeout in the ctor of sqlworkflowpersistenceservice on both the systems? Are both the systems pointing to the same persistence store? You can find some information about multiple host scenario and instance locking concepts here .

    Let me know if this helps to solve your problem. If not please give some more details about your scenario.

    -Sonali

     

    Thursday, November 30, 2006 6:12 AM
  •  

    What happens if you set the ownership timeout to TimeSpan.MaxValue?

     

    Monday, February 26, 2007 5:09 PM