Skip to content

MCP Thread Tools

The thread tools show what QIE's threads are doing, for a channel that shows Running while its messages do not move, or for an engine that is busy with something no channel explains. get_channel_threads covers one channel, get_processor_threads the shared processor threads, and get_thread_dump every thread in the JVM. None of them stops, interrupts or changes a thread. get_channel_threads and get_processor_threads only read; get_thread_dump also writes each node's dump file, so MCP clients and the audit log treat it as a call that changes something.

Each tool takes its samples on every HA node by default. instance takes them on one node instead, by its instance id. A node that has not answered 15 seconds after the samples should have been taken is listed in unansweredInstances, and the answer holds the nodes that did. On an HA cluster, a node still taking samples for an earlier call skips the new one, so it is listed in unansweredInstances too; ask again once the earlier call has answered. Call the thread tools one after another rather than at the same time.

Samples

get_channel_threads and get_thread_dump take samples, from 1 to 5 (default = 1), and intervalSeconds, the time between samples, from 2 to 7 (default = 2). One sample shows where each thread is. More samples show whether it is moving:

  • cpuMillisBetweenSamples is the CPU time a thread used between the first sample and the last.
  • topFrameChanged says whether the call at the top of its stack changed between them.

A thread that is RUNNABLE in a socket read and used no CPU between samples is waiting on the system at the other end. A thread that keeps using CPU in the same frames is busy, or looping. get_processor_threads always takes one sample, since counting which channels hold the processor threads needs no comparison.

Channel threads

get_channel_threads takes channelId and needs view rights in the channel's zone. For each node it returns:

Member Holds
threadGroups The channel's threads, grouped when they share a stack, so eight threads blocked in the same call read as one group with a count of 8. Each group gives the state, the lock waited on when every thread waits on the same one, and the stack, at most 30 frames with framesOmitted counting the rest. Each thread in a group gives its threadId, name, threadType, the sourceId and messageId it is working on, and its CPU time
lockHolders Each thread that holds a lock one of the channel's threads waits on, with its state, its stack and its CPU time. A holder can belong to another channel, or to no channel at all
deadlockedThreadIds Threads the JVM found deadlocked

A thread waiting on a lock names it in waitingOn and the thread that holds it in lockHolderThreadId, which is listed under lockHolders.

A lock holder in a channel outside the zones the user can view, or in no channel, shows only its stack and state: its name and channel are replaced by a note that an administrator can see them. Some thread names carry a channel's name, so the name is hidden too. Administrators see every holder in full.

Threads that a script or a library starts on its own are tied to no channel, so they do not show here. An administrator can see them with get_thread_dump.

Processor threads

get_processor_threads counts the shared processor threads on each node: how many there are, how many are idle, and how many are working on each channel, with their states. Channels are listed with the most threads first. Use it to spot one channel holding the processor threads while others wait.

Channels outside the zones the user can view are counted together under otherChannels, without their names. An administrator sees every channel by name.

Thread dump

get_thread_dump is for administrators only, as the Thread Dump button is in the console (see Thread Dump). It takes a full thread dump the way that button does, and each node also writes its dump to qieThreadDump.txt in its QIE home folder. With more than one sample, the file holds every sample in order, each under its own header. Only the last sample lists the locks each thread holds, since finding them pauses the JVM far longer than the rest of a sample; the header of each earlier sample says that it leaves them out. Every sample still shows the lock a thread waits on and the thread holding it.

A thread dump pauses the engine briefly

Taking a full dump pauses the JVM for a moment on each node. QIE allows one full dump every 30 seconds per cluster, counting dumps taken from the console. A request sooner than that is refused with operation_refused and says when to try again. The console's own Thread Dump button is never refused.

The answer is a summary per node, so that it fits within the MCP's answer limit:

Member Holds
threads and states How many threads the node has, and how many are in each state
deadlocked Threads the JVM found deadlocked
contendedLocks Locks that threads wait on, with how many wait, their names, and the thread that holds the lock
sharedStacks Stacks that several threads share, with how many and their names
busiestThreads The threads that used the most CPU, between samples when there is more than one

The answer also carries dumpId and textLength. To read the whole dump as text, call get_thread_dump again with dumpId, and pass range for the next part, as for any long text (see MCP Tool Results and Errors). Reading by dumpId takes no new dump. QIE keeps a dump for 10 minutes; after that its dumpId is not found.

Through the Hub

The Hub runs these three tools at one site per call. They take site and never tag (see Site Tools on a Hub).