Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rating: Thread Rating: 16 votes, 5.00 average. Display Modes
Old 05-20-2003, 02:57 PM   #1
artemio
Prospect
 
Join Date: Nov 2002
Location: Madrid, Spain
Posts: 33
Unhappy Killing a stuck process

When trying to open a text file (regular .txt file, about 4K) TextEdit became totally unresponsive
(cursor spinning nonstop, etc.). It can't be killed either with Command-Option-Control,
nor via the Dock. I tried killing it the usual Unix way, but it misteriously refuses to die:

Code:
% ps ax | grep -i textedit
19085  ??  U      0:00.66 /Applications/TextEdit.app/Contents/MacOS/TextEdit -psn_0_124256257
19237 std  R+     0:00.00 grep -i textedit
% kill -9 19085
%
% ps ax | grep -i textedit
19085  ??  U      0:00.66 /Applications/TextEdit.app/Contents/MacOS/TextEdit -psn_0_124256257
What else could I try, short of "sudo shutdown -r now"? FYI, this is what fstat and lsof
have to say about the "stubborn" TextEdit:

Code:
% fstat | grep -i textedit
artemio  TextEdit   19085   wd        2 drwxrwxr-t     5120 r   /
artemio  TextEdit   19085    0 40019844 ?rw-rw-rw-     null r   /dev
artemio  TextEdit   19085    1 39915140 ?rw-------  console w   /dev
artemio  TextEdit   19085    2 39915140 ?rw-------  console w   /dev
xxx  TextEdit   19085    3  3220508 -rw-r--r--  4182877 r   /
artemio  TextEdit   19085    4  2047167 -rw-r--r--     3177 r   /
artemio  TextEdit   19085    5  2047164 -rw-r--r--    38743 r   /
artemio  TextEdit   19085    6  3220512 -rw-r--r--   153584 r   /
artemio  TextEdit   19085    7  3220506 -rw-r--r--   527850 r   /
% lsof -c TextEdit
COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
TextEdit 19085 artemio  cwd   VDIR   14,9     5120        2 / (/dev/disk0s9)
TextEdit 19085 artemio    0r  VCHR    3,2      0t0 40019844 /dev/null
TextEdit 19085 artemio    1w  VCHR    0,0      0t0 39915140 /dev/console
TextEdit 19085 artemio    2w  VCHR    0,0      0t0 39915140 /dev/console
TextEdit 19085 artemio    3r  VREG   14,9  4182877  3220508 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras.rsrc
TextEdit 19085 artemio    4r  VREG   14,9     3177  2047167 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Resources/HIServices.rsrc
TextEdit 19085 artemio    5r  VREG   14,9    38743  2047164 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Resources/English.lproj/Localized.rsrc
TextEdit 19085 artemio    6r  VREG   14,9   153584  3220512 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc
TextEdit 19085 artemio    7r  VREG   14,9   527850  3220506 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
TextEdit 19085 artemio    8r                                0x03887154 file struct, ty=0x3, op=0x2dd090
Does this suggest anyhting to anybody?

TIA,

Artemio Gonzalez
artemiog@mac.com
artemio is offline   Reply With Quote
Old 05-20-2003, 03:27 PM   #2
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
odd, i can find no documentation in the ps command about the process state U

otherwise, it looks copacetic.

quit some other processes to see if it will unblock

anything in system.log?
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 05-20-2003, 04:17 PM   #3
blb
All Star
 
Join Date: Jan 2002
Location: CO, USA
Posts: 908
A look at the source says that state U is TH_STATE_UNINTERRUPTIBLE. Guess that may be a bit obvious now...

Not sure what precisely that means, nor how to change the state, however.
blb is offline   Reply With Quote
Old 05-20-2003, 05:29 PM   #4
Mikey-San
Hall of Famer
 
Join Date: Jan 2002
Posts: 3,541
A kill -9 failed to stop the process? Holy crizzap.

Have you tried this command:

% sacrifice -virgin [pid] -appGods

?
Mikey-San is offline   Reply With Quote
Old 05-20-2003, 06:16 PM   #5
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
thread in uninterruptible wait

The state TH_STATE_UNINTERRUPTIBLE means the thread is in an uninterruptible wait state. (Not that that is too much more useful to you.)

A google search on 'uninterruptible kill' ( http://www.google.com/search?q=uninterruptible+kill ) gives a bunch of discussions of this issue. The first hit (Answer Gang 83) is particularly interesting. But no solution better than killing the parent process is offered.

Last edited by hayne; 05-20-2003 at 06:18 PM.
hayne is offline   Reply With Quote
Old 05-20-2003, 06:33 PM   #6
artemio
Prospect
 
Join Date: Nov 2002
Location: Madrid, Spain
Posts: 33
Thanks, Merv. The only thing in /var/log/system.log that looks unusual is this line:

May 20 16:53:07 tillina csmount[19034]: getattr for non-existent file handle 0x98765432 0x2

(As I said in my previous post, TextEdit actually started getting "stuck" right after trying to open a file). There was a csmount process running (with a PID close to TextEdit's) that I killed, but it's still impossible to kill TextEdit.

Artemio
artemio is offline   Reply With Quote
Old 05-20-2003, 07:39 PM   #7
blb
All Star
 
Join Date: Jan 2002
Location: CO, USA
Posts: 908
Hmm, csmount is part of the ftp filesystem; is the file you're attempting to open in TextEdit going over that?
blb is offline   Reply With Quote
Old 05-20-2003, 08:09 PM   #8
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
odd, textedit here has some network connections:
Code:
$ lsof -c TextEdit; fstat |grep -i textedit
COMMAND    PID USER   FD   TYPE     DEVICE SIZE/OFF     NODE NAME
TextEdit 28283 merv  cwd   VDIR      14,22     5376        2 / (/dev/disk1s9)
TextEdit 28283 merv    0r  VCHR        3,2      0t0 59707780 /dev/null
TextEdit 28283 merv    1w  VCHR        0,0      0t0 59708292 /dev/console
TextEdit 28283 merv    2w  VCHR        0,0      0t0 59708292 /dev/console
TextEdit 28283 merv    3r                                    0x0394645c file struct, ty=0x3, op=0x2dd090
TextEdit 28283 merv    4r  VREG      14,22     3177     4465 / (/dev/disk1s9)
TextEdit 28283 merv    5r  VREG      14,22    38743     4462 / (/dev/disk1s9)
TextEdit 28283 merv    6r  VREG      14,22   156864   914998 / (/dev/disk1s9)
TextEdit 28283 merv    7r  VREG      14,22   527850   914988 / (/dev/disk1s9)
TextEdit 28283 merv    8r  VREG      14,22  4182877   914994 / (/dev/disk1s9)
TextEdit 28283 merv    9u  inet 0x064d04ec      0t0      TCP localhost:58657->localhost:ipp (CLOSE_WAIT)
TextEdit 28283 merv   10u  inet 0x05873d1c      0t0      TCP localhost:58656->localhost:ipp (CLOSE_WAIT)
merv     TextEdit   28283   wd        2 drwxr-xr-t     5376 r   /
merv     TextEdit   28283    0 59707780 ?rw-rw-rw-     null r   /dev
merv     TextEdit   28283    1 59708292 ?rw-------  console w   /dev
merv     TextEdit   28283    2 59708292 ?rw-------  console w   /dev
merv     TextEdit   28283    4     4465 -rw-r--r--     3177 r   /
merv     TextEdit   28283    5     4462 -rw-r--r--    38743 r   /
merv     TextEdit   28283    6   914998 -rw-r--r--   156864 r   /
merv     TextEdit   28283    7   914988 -rw-r--r--   527850 r   /
merv     TextEdit   28283    8   914994 -rw-r--r--  4182877 r   /
merv     TextEdit   28283    9* internet stream tcp 64d04ec
merv     TextEdit   28283   10* internet stream tcp 5873d1c
artemio's -- no.

wonder if something in that arena collided.
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 05-21-2003, 02:43 AM   #9
artemio
Prospect
 
Join Date: Nov 2002
Location: Madrid, Spain
Posts: 33
No, the file I was trying to open was a local file. In fact, the csmount process probably has to do with an ftp server I accessed before (but not right before) TextEdit started acting up. Merv's point about network connections being open by his TextEdit is interesting. However, a perfectly healthy copy of TextEdit running in my home computer has no network connections; in fact, the lsof and fstat output from the healthy TextEdit is very similar to that of the "sick" one:
Quote:
lsof -c TextEdit; fstat |grep -i textedit
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
TextEdit 466 artemio cwd VDIR 14,9 5760 2 / (/dev/disk0s9)
TextEdit 466 artemio 0r VCHR 3,2 0t0 43040388 /dev/null
TextEdit 466 artemio 1w VCHR 0,0 0t0 42909828 /dev/console
TextEdit 466 artemio 2w VCHR 0,0 0t0 42909828 /dev/console
TextEdit 466 artemio 3r VREG 14,9 4182877 369964 /System/Library/Frameworks/
Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras.rsrc
TextEdit 466 artemio 4r VREG 14,9 3177 5126 / -- Resources/HIServices.rsrc
TextEdit 466 artemio 5r VREG 14,9 38743 5123 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/
HIServices.framework/
Versions/A/Resources/English.lproj/Localized.rsrc
TextEdit 466 artemio 6r VREG 14,9 153584 369968 /System/Library/Frameworks/
Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/
Versions/A/Resources/HIToolbox.rsrc
TextEdit 466 artemio 7r VREG 14,9 527850 369958 /System/Library/Frameworks/
Carbon.framework/
Versions/A/Frameworks/
HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
TextEdit 466 artemio 8r 0x0293cf5c file struct, ty=0x3, op=0x2dd090
artemio TextEdit 466 wd 2 drwxrwxr-t 5760 r /
artemio TextEdit 466 0 43040388 ?rw-rw-rw- null r /dev
artemio TextEdit 466 1 42909828 ?rw------- console w /dev
artemio TextEdit 466 2 42909828 ?rw------- console w /dev
artemio TextEdit 466 3 369964 -rw-r--r-- 4182877 r /
artemio TextEdit 466 4 5126 -rw-r--r-- 3177 r /
artemio TextEdit 466 5 5123 -rw-r--r-- 38743 r /
artemio TextEdit 466 6 369968 -rw-r--r-- 153584 r /
artemio TextEdit 466 7 369958 -rw-r--r-- 527850 r /

Finally, hayne's observation about the meaning of "U" in ps was quite enlightening (by the way, hayne, where did you get it from? I couldn't find it in the regular man pages). From the thread quoted in hayne's message it seems that the only way (if any) to kill an uninterruptible process (by the way, according to the thread this type of process is almost always related to a disk driver and the "mount" command) is to kill its parent process. But, as far as I could find (using pstree), the parent process of TextEdit is not a shell but "loginwindow". What would be the effects of killing loginwindow? Would that be similar to an "unclean" logout, or perhaps even more drastic?

Thanks everybody for your help,

Artemio

[edit: fold -mt]

Last edited by mervTormel; 05-21-2003 at 06:16 AM.
artemio is offline   Reply With Quote
Old 05-21-2003, 03:07 AM   #10
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
Quote:
hayne's observation about the meaning of "U" in ps was quite enlightening (by the way, hayne, where did you get it from? I couldn't find it in the regular man pages).

I merely googled on TH_STATE_UNINTERRUPTIBLE - it was blb who found the interpretation of 'U' by looking at the source code. (see blb's post above)

Quote:
as far as I could find (using pstree), the parent process of TextEdit is not a shell but "loginwindow". What would be the effects of killing loginwindow? Would that be similar to an "unclean" logout, or perhaps even more drastic?

I believe it would be like an "unclean" logout. Better just to logout normally rather than doing that.

But if you can get this problem to happen reproducibly, you should let Apple know about it.

Re: pstree
I just found out that if you use the "-g 2" option, it gives a much nicer display.

Last edited by hayne; 05-21-2003 at 03:12 AM.
hayne is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 12:18 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.