# "stuck" processes...how to find and "kill"



## mapski99 (Jun 17, 2003)

In the terminal, using top, I see that there is a "stuck" process. But top does not identify the state of any process, so I can't tell which one is stuck. 

So I try "ps aux" and get a very long list of items, but they are just active, sleeping, or zombie. None of the zombie items can be acted upon (ie killed). 

So where is this "stuck" process, what tool/command will identify it.

thanks,
joe


----------



## Arden (Jun 17, 2003)

Is it an application, or a process in the background?  Because if it's an application (which it doesn't sound like it is), you can control/right-click on Dock icons and it will say if it's not responding.

In top, don't all the running process have dynamically differing stats?  The amount of RAM, CPU usage, etc. should change from one interval to another.  Look for one that doesn't change, and try to kill it.


----------



## mapski99 (Jun 17, 2003)

it's definitely not an obvious applications that is either not responding and red in the force-quit dialog.

It's an interesting idea, but way too much work, since there are 70 processes and over half taking up 0.0%.

I was hoping (figuring based on the power of UNIX), that there would be a command to hunt down the "stuck" process.

joe


----------



## Darkshadow (Jun 18, 2003)

Well, what do you mean by stuck?  How do you know it's stuck?

As to those zombie processes you see in ps - they're not actually there anymore, and aren't using up any memory...the kernel just hasn't released the reference to them yet (more or less).  They may dissapear after a while, or may not, but they're not going to harm anything.


----------



## mapski99 (Jun 18, 2003)

This is the first part of my top output

Processes:  68 total, 2 running, 1 stuck, 65 sleeping... 249 threads   09:
Load Avg:  0.93, 0.49, 0.34     CPU usage:  34.3% user, 14.9% sys, 50.8
SharedLibs: num =  122, resident = 31.4M code, 2.66M data, 10.0M LinkEdit
MemRegions: num = 9149, resident =  184M + 14.3M private,  227M shared
PhysMem:  81.1M wired,  186M active,  437M inactive,  703M used, 64.6M fre
VM: 5.66G + 71.9M   62824(0) pageins, 60282(0) pageouts

  PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSI
24268 smbd         0.0%  0:00.32   1     8    33   240K  1.41M   928K  16.
23141 Terminal    66.5%  0:30.20   5    77   271  2.89M+ 17.5M  21.5M+  13
23037 Microsoft    0.0%  3:00.74   7   148   543  14.1M  66.1M  41.5M   31


----------



## mapski99 (Jun 18, 2003)

well that makes sense about the "zombie" processes. when I tried to kill them, I got a message that the PID did not exist.

here is an excerpt from the man pages for "ps" (which is what Darkshadow said)

     When printing using the command keyword, a process that has exited and
     has a parent that has not yet waited for the process (in other words, a
     zombie) is listed as ``<defunct>'', and a process which is blocked while
     trying to exit is listed as ``<exiting>''.  Ps makes an educated guess as
     to the file name and arguments given when the process was created by
     examining memory or the swap area.  The method is inherently somewhat
     unreliable and in any event a process is entitled to destroy this infor-
     mation, so the names cannot be depended on too much.


----------



## Arden (Jun 18, 2003)

What's the difference, anyway?  Is it really going to suck down your CPU cycles and RAM use, or just your time trying to figure out which is stuck?


----------



## mapski99 (Jun 18, 2003)

Mostly interested...but also curious ; )

I guess the real final answer depends on what it is, what is actually stuck. When I find out how to find the stuck process, then I when I do run into a problem, I can hunt down a stuck process to see if it's the culprit, and then kill it.


----------



## Mareo Raft (Dec 29, 2015)

I also would like to know how to find the process that the top program says is "stuck".  Does anybody know how?


----------



## DeltaMac (Dec 29, 2015)

(Wow! old thread!)
You CAN look in your Activity monitor. Make sure that it displays "All Processes", and not the default "My Processes".
Check in both CPU and Memory tabs. You should be able to see processes that are listed as "Stopped Responding".
Select any that are suspect for you. Click the Information button (or just press Command-I), which will show you some more information about the process, and what process are parent processes. Some will also have information about the files and ports that are open for that process.

I'm not sure if a "stuck" process in Unix is the same thing as a process that has "Stopped Responding" in OS X

Finally, "top" only says there is a "stuck process", but doesn't tell you any information about that process, or even if it remains stuck.
Your best bet will be to see what is listed in the Activity Monitor.

Finally - are you just curious? Or are you having an actual problem with your OS X system?
What version of OS X are you running?


----------



## xFile (Jun 8, 2019)

> (Wow! old thread!)

Yes, you're right but I think this is of general interest for every Mac user  

A very good explanation can be found here - in short: "stuck" is not automaticly bad.

_"So a process in stuck state means that the process/thread is in an uninterruptible wait state.
Is it part of the normal life cycle of process? Yes, it is. What is not normal is that a process stays in this state for a long time. That's a bad sign."_

Hope this is of any help for people searching for this...


----------

