Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
How to detect stuck scheduled jobs that may be stuck on a non-existent node - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • How to detect stuck scheduled jobs that may be stuck on a non-existent node
KB0723049

How to detect stuck scheduled jobs that may be stuck on a non-existent node


8805 Views Last updated : Apr 7, 2024 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

Description


The glide.scheduler thread on an application node will claim jobs from the sys_trigger table to run on that node.  Sometimes we may encounter the circumstance where a scheduled job is claimed by a node and then some maintenance occurs and the node is retired or moved.  In those cases, the claimed jobs will be in a "limbo" state.  This knowledge article demonstrates how one can identify such scheduled jobs.

 

Procedure


Navigate to the System Maintenance > Scripts - Background module, copy the following snippet of javascript into the field labeled "", and click on the Run Script button.

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
showScheduledJobsStuckOnMissingNodes();

function showScheduledJobsStuckOnMissingNodes() {
    var gr = new GlideRecord('sys_trigger');
    // Query only jobs that are queued or "running"
    gr.addQuery('state', 'IN', '1,2');
    // Filter out those that are not claimed by any node
    gr.addQuery('claimed_by', '!=', 'NULL');
    // Filter out those that are claimed by a valid node
    var gr2 = new GlideRecord('sys_cluster_state');
    gr2.query();
    while (gr2.next()) {
        gr.addQuery('claimed_by', '!=', gr2.system_id); // Filter out any valid system_id values.
    }
    gr.query();
    // Display a warning for each suspect scheduled jobs
    while (gr.next()) {
        gs.print('WARNING: sys_trigger.' + gr.sys_id + ' has a state of ' + gr.state + ' and is claimed by node ' + gr.claimed_by)
    }
}

 

Applicable Versions


All


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.