locked
Workflows stuck in scheduled states and failed workflows RRS feed

  • Question

  • I had custom workflows timing out due to the sql broker service not being enabled.  After enabling the service, I flushed the cache via Stopping services, and clearing out "C:\Program Files\Microsoft System Center 2012\Service Manager\Health Service State".  New workflows are working fine now, but for my custom workflows I still see the old failed logs. The workflow actually ran but it timed out and registered a failure.  I am not sure what to do with the Failed logs and scheduled items.  Is there an sql query that will display failed and or scheduled workflows?  From a similarly title forum I tried their suggested sql query:

    select 
    	job.TimeScheduled,
    	job.TimeStarted,
    	job.TimeFinished,
    	job.ErrorCode,
    	job.ErrorMessage,
    	convert(xml,job.Output),
    	job.Status,
    	Disp.DisplayName from JobStatusView  Job
    join DisplayStringView Disp
    on job.TaskId = disp.LTStringId
    where SubmittedBy = 'DOMAIN\YourWorkflowAccount' and disp.LanguageCode = 'enu'
    order by TimeScheduled desc

    Is there a key for what the status number from this type of query means?

    Tuesday, September 15, 2015 5:07 PM

Answers

  • I took a quick look at the JobStatusView and didn't actually find a way to resolve the DisplayName for each workflow strangely enough :S

    Yes, the old workflow history should be groomed automatically.

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    • Proposed as answer by BuchatechMVP Wednesday, September 23, 2015 4:17 AM
    • Marked as answer by Misha Rudiy Wednesday, September 23, 2015 8:12 PM
    Monday, September 21, 2015 6:38 AM

All replies

  • Hi Misha,

    Take a look at the XML output from the query. Most of the time the error message in there makes sense, otherwise feel free to share it here :)

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    Tuesday, September 15, 2015 5:12 PM
  • On one of my workflows I get  error: Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\M
    icrosoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.  It shows the status code as 2 and in the workflow log it is successful.  More importantly it modifies the workflow as expected. I will revisit this particular workflow.

    All the other workflows with status 2 show this in the xml

    <DataItem type="Microsoft.Windows.SerializedObjectData" time="2015-09-15T17:13:20.8041682Z" sourceHealthServiceId="422979fc-4669-71e7-3f77-b504063cc7f0">
      <SerializationSettings Type="OpsMgrSerialization" Depth="3" />
      <Description />
    </DataItem>
    What doe the status 2 3 and 0 mean?  Also this query only seems to show my custom workflows.  Is there any way to see the status of a builtin workflow?

    Tuesday, September 15, 2015 5:33 PM
  • select 
    	job.TimeScheduled,
    	job.TimeStarted,
    	job.TimeFinished,
    	job.ErrorCode,
    	job.ErrorMessage,
    	convert(xml,job.Output),
    	job.Status
    from JobStatusView  Job
    order by TimeScheduled desc

    If remembered correctly, 0 = New, 1 = Scheduled, 2 = Successful, 3 = Error.

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    • Proposed as answer by BuchatechMVP Wednesday, September 23, 2015 4:17 AM
    Tuesday, September 15, 2015 5:44 PM
  • So it looks like all the jobs that have time out errors (Status 3) are from before the time that I enabled the sql broker service. I have a lot of jobs with yesterdays date with status 0.  They do not show a display name though or any xml output.  Any ideas how to see which ones they are? I really appreciate your assistance by the way.
    • Proposed as answer by BuchatechMVP Wednesday, September 23, 2015 4:17 AM
    Tuesday, September 15, 2015 6:03 PM
  • Monitoring for a couple of days, It looks like new workflows are working just fine.  The old ones that were scheduled when the sql broker service was disabled still show up in a scheduled state.  I can manually apply the settings that the workflow should have done.  Will these objects be removed from the Jobstatus table after 7 days?
    Friday, September 18, 2015 1:49 PM
  • I took a quick look at the JobStatusView and didn't actually find a way to resolve the DisplayName for each workflow strangely enough :S

    Yes, the old workflow history should be groomed automatically.

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    • Proposed as answer by BuchatechMVP Wednesday, September 23, 2015 4:17 AM
    • Marked as answer by Misha Rudiy Wednesday, September 23, 2015 8:12 PM
    Monday, September 21, 2015 6:38 AM
  • test
    Wednesday, September 23, 2015 12:40 AM