skwpspace yan pritzker’s home on the web

skwpspace is Yan Pritzker's home on the web

Blog :: Photography :: About Me

TwitterCounter for @skwp

Get the news feed
Get updates by email
Follow me on twitter

hello, i'm yan

This blog is about startups, blogging, Ruby On Rails, virtualization and cloud computing, photography, customer service, marketing, ux and design, git, and lots more.

Top Posts

planypus

I'm the founder of Planypus, the place to share your plans!

cohesiveft

Accessible, manageable, virtualized application stacks ready to download or deploy to the cloud!

flickr

smokingThe old man and the accordionBicycle 6x6Eva 6x6Shaffies 6x6Phone Booth Velvia 6x6WynnStar 6x6

Archives

Contact

Reach me at yan at pritzker.ws

Posted
20 May 2008 @ 7pm

Tagged
OSX

Disabling spindump on OSX to prevent slowdown after a crash

Update: it’s better to use a spindump script that sleeps, otherwise launchd keeps trying to restart it every ten seconds. Thanks to Steve Ryner for the script. And yes, it’s very simple but here it is :-)


#!/bin/sh
while true
do
sleep 60000
done

Sometimes when things crash on OSX (biggest offenders: Quicktime, and Safari playing flash movies), a program called spindump fires up. This offensive piece of bad engineering thinks its ok to eat 100% of my cpu and thrash my disk just to catalog what happened.

While this is a great idea in theory, and I’m sure it helps Apple engineers debug problems, it does absolutely nothing for me trying to bring my machine into a usable state. Fighting spindump for resources while I try to kill the hanging program is not fun. And many people on online forums seem to think the same. Most of the time I’m barely able to pull up the activity monitor and nuke spindump before it goes off to lala land never to return. Granted things don’t crash often, but when they do there is hell to pay.

Well, we don’t have to submit to this madness anymore. It occurred to me that I could simply rename the spindump executable so that OSX could not find it. So I renamed /usr/sbin/spindump to /usr/sbin/spindump.disabled. I had to wait for my first crash in order to verify that this didn’t break anything, and sure enough I had a quicktime crash just the other night. The system promptly recovered from the crash and did not slow down as previously. Mission accomplished!

Apple is a company built on user experience. But spindump is one of the worst user experience violations in OSX. I know there may not be an easy way around it, but certainly at the very least changing the priority of this process so that it’s not able to eat all system resources may be a step in the right direction. I hope to see an improvement in future versions of the operating system. Until then, spindump is dead to me.


14 Comments

Posted by
Alec
21 May 2008 @ 9am

Thanks Yan. I’ve been having a lot of trouble with spindump as well - particularly with Safari. We’ll see if this solves the problem.


Posted by
Steve Ryner
23 May 2008 @ 2pm

Unfortuantely, the logs now show launchd trying to fire up spindump every 10 seconds:

5/23/08 9:47:55 AM com.apple.launchd[1] (com.apple.spindump[5000]) posix_spawnp(”/usr/sbin/spindump”, …): No such file or directory
5/23/08 9:47:55 AM com.apple.launchd[1] (com.apple.spindump[5000]) Exited with exit code: 1
5/23/08 9:47:55 AM com.apple.launchd[1] (com.apple.spindump) Throttling respawn: Will start in 10 seconds

A dummy that returns an “okay” exit code might work.


Posted by
Yan
23 May 2008 @ 3pm

doh, good catch. I should have checked the logs, I was just so excited to be rid of the evil little bastard :-) I’ll experiment with a dummy script


Posted by
Steve Ryner
23 May 2008 @ 3pm

Actually I think we need a dummy that never exits so launchd doesn’t launch it again. I tried

touch /usr/sbin/spindump
chmod 775 /usr/sbin/spindump

And it’s “better” but still launching every 10 seconds :D

5/23/08 10:13:36 AM com.apple.launchd[1] (com.apple.spindump) Throttling respawn: Will start in 10 seconds
5/23/08 10:13:47 AM com.apple.launchd[1] (com.apple.spindump) Throttling respawn: Will start in 10 seconds


Posted by
Steve Ryner
23 May 2008 @ 3pm

My spindump is now sleeping peacefully :)


Posted by
Yan
23 May 2008 @ 3pm

I made a dummy that did exit(0) and it didn’t die..launchd was still respawning every 10 seconds. I don’t know why that is.

Also, while we’re on the topic of syslogs I noticed something is trying to spawn httpd and failing to read the log dir. May 23 10:31:52 skwp-mbp org.apache.httpd[3604]: Unable to open logs. Very strange because I ran apache via the Sharing pane and it worked.

Maybe it’s time to reboot this box..it’s been a while.


Posted by
Steve Ryner
23 May 2008 @ 3pm

See, when you exit then it gets relaunched. I’ve mailed you a short script since it’s too embarrassingly stupid to post to your blog :)

Examining logs is always good. There are also scripts to rotate them manually if like me you use a laptop that may not be running when they ’should’ be cleaned.


Posted by
Andrew Livingston
3 June 2008 @ 4am

I used Steve Ryner’s Script and a template at

http://www.afp548.com/Articles/Jaguar/startupitems.html

to create a startup item for sleeping spindump. I’ve tried it on a couple of known Force Quit simulations after a shutdown/bootup, and it seems to work just fine. Here goes:

at your shell prompt, type:

sudo mkdir /Library/StartupItems/killspindump

then go to that directory and type:

sudo nano killspindump

paste the following text into the file and save and exit:

#!/bin/sh

# Script by Steve Ryner, 2008.
# StartupItem based on “Script to Control Exim” by
# Joel Rennich, http://www.afp548.com, Sept. 2002
# all copyrights waved

. /etc/rc.common

# Script to sleep spindump

# this is to start it

if [ "$1" == "start" ]
then
ConsoleMessage “Sleeping Spindump”
while true
do
sleep 60000
done

# this is to restart it

elif [ "$1" == "restart" ]
then
ConsoleMessage “Resleeping Spindump”
while true
do
sleep 60000
done

fi

That’s the end of the file. Now type:

sudo nano StartupParameters.plist

and paste the following text into the file:

Provides

Spindump Sleep Script

Messages

stop
Waking Spindump
start
Sleeping Spindump

Requires

System Log

OrderPreference
None
Description
Spindump Sleep Script

And that’s the end of the file. Following the instructions at the link above, I made a folder called “Resources” in the killspindump folder. There’s nothing in it, so I don’t know if it’s necessary. Same with the line in the plist file:

stop
Waking Spindump

Obviously my startupitem doesn’t have any code for doing that, but at this point I don’t want to mess with success. Speaking of which, if you try this and it doesn’t work, or you find a better way to do it, let me know.


Posted by
Andrew Livingston
3 June 2008 @ 4am

Whoops. Didn’t realize that the xml file would appear formatted. Here’s the text for the plist file with colons in front of it

:
:
:
:
: Provides
:
: Spindump Sleep Script
:
: Messages
:
: stop
: Waking Spindump
: start
: Sleeping Spindump
:
: Requires
:
: System Log
:
: OrderPreference
: None
: Description
: Spindump Sleep Script
:
:

Sorry for the difficulties, but I’ve already spent enough time on this. I’m not going to relearn HTML tonight :P


Posted by
Andrew Livingston
3 June 2008 @ 4am

Wow, that didn’t work either. If anyone is interested in this and CAN format HTML properly, let me know how and I’ll repost it.


Posted by
Yan
3 June 2008 @ 4am

Hey Andrew thanks!
Try http://pastie.org/ for pasting complex things :-)


Posted by
Andrew Livingston
3 June 2008 @ 5am

Thanks, Yan!

Here’s a link to the contents of “killspindump”:

http://pastie.org/207662

Here’s a link to the contents of “StartupParameters.plist”:

http://pastie.caboo.se/207665

If you click the “Download” button on those pages I believe it will download them as a shell script and an html file respectively, so you might only have to rename the files and create the directories. Otherwise, just create the files per my 1st post, follow the pastie links, click the “View” button on those pages, and then just copy and paste the text into the files. Best of luck, and please let me know if this doesn’t work for you.


Posted by
Barney15e
18 June 2008 @ 11am

Try using Lingon. Lingon allows you to edit the launchd items. I would think you could just delete the spindump entry from launchd, thus preventing it from loading, ever.


Posted by
Patrick
11 September 2008 @ 1am

I just typed this into terminal:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.spindump.plist

to prevent launchd to start spindump and it works great.

Greetings


Leave a Comment

Google entering big brother territory with Health Virtualization BoF at RailsConf