1

I have created a state machine workflow in Visual Studio 2013.

  • initial stage: it sends an email to some members.
  • second stage : it should wait for 5 days until all of the users take actions.
  • third stage : an email should go to final approver once all of the members approve/ take action on the item.

If the workflow is set for 10 minutes or 20 minutes, it works fine and sends an email to next person. But when I increase the time to like 30 minutes or an hour it breaks.

I am using a hard coded while loop to hold the workflow for certain time ,

duedate = datetime.now.addminutes(30.0);
 while(ispending == false)
 {
  if(datetime.now > duedata)
    {     
    ispending = true;
    }
 }

the logs that I am getting:

system account : an error has occured.

01/03/2016 19:45:49.11 OWSTIMER.EXE (0x3D84) 0x6238 SharePoint
Foundation Monitoring aeh57 Medium Sql Ring buffer status eventsPerSec
= ,processingTime=0,totalEventsProcessed=0,eventCount=0,droppedCount=0,memoryUsed=0
01/03/2016 19:45:49.23 OWSTIMER.EXE (0x3D84) 0x2514 SharePoint
Foundation Legacy Workflow Infrastructure 88xr Unexpected WinWF
Internal Error, terminating workflow Id#
e4e4d4d4-3606-418e-8403-399de7225f44
74a5519d-d047-30d1-cd87-5ff3ad9c69b8 01/03/2016 19:45:49.24
OWSTIMER.EXE (0x3D84) 0x2514 SharePoint Foundation Legacy Workflow
Infrastructure 98d4 Unexpected System.TypeInitializationException: The
type initializer for 'ADCouncil.Core.ADCouncilServiceProvider' threw
an exception. ---> System.Exception: Failed to Open ADCouncil
configuration section. nsure that your configuration is properly set.
at ADCouncil.Core.ADCouncilServiceProvider.LoadConfig() at
ADCouncil.Core.ADCouncilServiceProvider..ctor() at
ADCouncil.Core.ADCouncilServiceProvider..cctor() --- End of inner
exception stack trace --- at
 ITPCWorkFlow_ITPC.ITPCWorkflow.ITPCWorkflow.codeActivity1_ExecuteCode(Object
sender, EventArgs e) at
System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty
dependencyEvent, Object sender, EventArgs e) at
System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext
executionContext) at System.Wo... 74a5519d-d047-30d1-cd87-5ff3ad9c69b8
01/03/2016 19:45:49.24* OWSTIMER.EXE (0x3D84) 0x2514 SharePoint
Foundation Legacy Workflow Infrastructure 98d4 Unexpected
...rkflow.ComponentModel.ActivityExecutor`1.Execute(T activity,
ActivityExecutionContext executionContext) at
System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime
workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()
74a5519d-d047-30d1-cd87-5ff3ad9c69b8 01/03/2016 19:45:49.25
OWSTIMER.EXE (0x3D84) 0x2514 SharePoint Foundation Upgrade ajyw6 High
01/03/2016 19:45:49.25 OWSTIMER (0x3D84) 0x2514 SharePoint Foundation
Upgrade SPHierarchyManager ajyw6 DEBUG [SPTree Value=SPSite
Url=http://srumos08/departments/ITPC] added to dependency cache by
lookup 74a5519d-d047-30d1-cd87-5ff3ad9c69b8
74a5519d-d047-30d1-cd87-5ff3ad9c69b8 01/03/2016 19:45:49.26
OWSTIMER.EXE (0x3D84) 0x2514 SharePoint Foundation Upgrade ajyw6 High
01/03/2016 19:45:49.26 OWSTIMER (0x3D84) 0x2514 SharePoint Foundation
Upgrade SPHierarchyManager ajyw6 DEBUG [SPTree Value=SPSite
Url=http://srumos08 added to dependency cache by lookup
74a5519d-d047-30d1-cd87-5ff3ad9c69b8
74a5519d-d047-30d1-cd87-5ff3ad9c69b8 01/03/2016 19:45:49.32
OWSTIMER.EXE (0x3D84) 0x2514 SharePoint Foundation Monitoring b4ly
Medium Leaving Monitored Scope (WorkflowTelemetryScope). Execution
Time=1186.82702689867 74a5519d-d047-30d1-cd87-5ff3ad9c69b8 01/03/2016
19:45:49.33 OWSTIMER.EXE (0x3D84) 0x2514 SharePoint Foundation 

It is pointing to one DLL which I am using to retrieve the users from Active directory. But the same DLL works if I set it for 5 to 20 minutes but not more than that.

  • Is there any service which is trying to restart the workflow?
  • Is there something I am missing?
  • Is the hard coded while loop the reason that it is not holding the workflow for that amount of time?

1 Answer 1

1

You have different problems here:

  • It's not a good practice at all to wait x minutes with a loop. The good practice is to add a Pause (delay) activity in the event phase of your state.
  • Since the loop actually consumes CPU, it probably fails in W3WP processes after X minutes (the Web process that initially runs your WF). Then, the WF is taken back by the OWSTIMER process. Your problem is probably: that processes misses the configuration (probably from web.config) it needs to initialize your ADCouncilServiceProvider object. One way arround this is to add the same config in the owstimer.exe.config file (in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\15\BIN\").
4
  • thanks Evariste , so i should be using the delayactivity instead of that while loop . but i have a prblm in that too , delayactivity will wait for say 5 days and will check if all of the members approved or not . but what if the users approved during that time period or before the time which delayactivity is waiting for. hope u got my point. Jan 5, 2016 at 7:02
  • Yup, I got your point. Your scenario is definitely OK, and state-machine WF have been designed for this! In the Init phase of each state, you create tasks, send emails, etc. In the event phase, you can listen to different events: e.g. one pause event for the "timeout" and one even trigerred each time a task is done. When a task is done, you can check if all members have done it, and transition to next state.
    – Evariste
    Jan 5, 2016 at 8:05
  • thanks @Evariste once again , i have another issue sharepoint.stackexchange.com/questions/166162/…. and i strongly believe this is the also the major issue. Jan 5, 2016 at 9:11
  • ,dude can u help me with this bcoz u know the whole scenario.sharepoint.stackexchange.com/questions/166221/… Jan 6, 2016 at 7:13

Your Answer

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

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