Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Avoid a long system lockup related to sleeping shares Network
I often use Personal File Sharing to move files between the various Macs here at macosxhints.com HQ. A typical scenario will have me connecting to the desktop machine from my MacBook Pro to move some files I've modified back to the main machine. At some point after that, I'll move back to the main machine and continue working, then put the main machine to sleep when I'm done. Later in the day, I switch back to the MacBook Pro, and notice that the main machine's share is still mounted. "I should eject that, since I'm done with it now," I say to myself, forgetting that I've put the main machine to sleep.

Blammo. As soon as I press Eject, the MacBook Pro enters what turns out to be a 12-minute cycle of uselessness. I get the spinning rainbow in every application, and keyboard and mouse input is ignored -- everything except clicking on an application's window to activate it. (Yes, 12 minutes -- here's the log file, with some comments.) But I cannot get the Force Quit dialog to show, I can't type in Terminal, and the machine is essentially a brick. Then, 12 minutes later, the system realizes that the connected server is no longer there, ejects the mounted share, and everything returns to normal (and some number of the keyboard and mouse inputs I've entered are then processed en masse, which can be entertaining to watch).

I've had this problem for quite a while, but only got serious about debugging it a week or so ago. With some help from Kirk, we figured out what was going on. On Kirk's machine, ejecting a sleeping share resulted in the Finder (and only the Finder) hanging for a minute or so. When we compared out network setups, the only real difference was that Kirk uses DHCP IP addresses while I use static IP addresses. When I ran the same test with my machines set to use DHCP addressing, the 12-minute hang vanished, and I saw the same behavior as did Kirk.

I don't, however, want to use DHCP (not for any good reason, of course; just personal preference). So I did some more experimenting, trying to find a cleaner way to exit this hang when using static IP addresses. What I found was that if I clicked on the share's name in the sidebar, I'd get the much nicer one-minute Finder-only hang, instead of the 12-minute total lockup. (As a side note, I did find a couple of possibly-useful prefs settings (afp_reconnect_interval [default: 10] and afp_reconnect_retries [default:12]) in the com.apple.AppleShareClientCore section of the .GlobalPreferences plist file, but modifying them didn't seem to have any effect on the 12-minute hang.)

So the hint here is two-fold: first, use DHCP if you do a lot of AFP share mounting, as you'll avoid the problem entirely. But if you do use static IP addressing, then do not hit the Eject icon for any sleeping shares -- just click on the share name instead, and you'll see a much nicer (and quicker!) timeout process.
    •    
  • Currently 2.60 / 5
  You rated: 3 / 5 (5 votes cast)
 
[17,193 views]  

Avoid a long system lockup related to sleeping shares | 30 comments | Create New Account
Click here to return to the 'Avoid a long system lockup related to sleeping shares' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Avoid a long system lockup related to sleeping shares
Authored by: frgough on May 22, '07 08:17:30AM

OS X's handling of dropped connections has been brain dead from day one. It's about my only frustration with the operating system.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: mm2270 on May 22, '07 11:05:26AM

Totally totally agree.

It's incredibly frustrating how the OS can lock up and become useless for a period of time when it realizes a share is no longer connected. There has GOT to be a more graceful way to handle this. I just wish for once, JUST once, Apple would actually concentrate on fixing all these little stupid issues, instead of working on "new" features. That's all I ask of them, and they just refuse to do it.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: landis on May 22, '07 03:49:33PM

I wish it was my *only* frustration with OS X. It's just one of several, but it's certainly a major one.

But like they say about democracy - it's the worst system except for all the others.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: Coumerelli on May 22, '07 08:40:21AM

I would like to say that using SMB shares also cause the 1 minute-ish hang after a location move (work to home having only shut the lid for sleep).

And using this hint as a springboard, I've also noticed that when I open the lid to my CoreDuo MacBook it sometimes takes as much as 3 (?) minutes and as few as maybe 2 seconds for the login screen to appear. Otherwise I just get the beachball for the 3 minutes. I have "lock screen on wake-up" enabled. I tried for a few days to just turn off my airport before I closed the lid thinking, if it is more gracefully disconnected from the network that THAT would help waking up on the other end. No dice. So, I keep searching. It doesn't seem to matter either if I've rememered or forgotten to nix the connection to the shares first either. Also, this has happened probably since Panther (I've got 10.4.9) and also with my AL PowerBook 15" FW 800.

---
"The best way to accelerate a PC is 9.8 m/s2"



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: splatkus on May 22, '07 08:41:11AM
The best way to deal with this problem is to simply avoid it. Use PowerSwitch to put your system to sleep and you can have it eject any network shares automatically.

PowerSwitch

[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: jecwobble on May 22, '07 01:04:55PM

Maybe I'm reading it wrong, but PowerSwitch appears to eject volumes mounted on the the computer being put to sleep. The problem discussed here is when you try to eject a mounted volume that has already been put to sleep.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: afragen on May 22, '07 08:51:19AM

By any chance are you changing routers during this time or are you still connected to the same LAN?



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: robg on May 22, '07 10:38:39AM

Same LAN -- the laptops use AirPort, and the desktops are wired. But all on the same router and subnet, etc.

-rob.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: afragen on May 22, '07 03:53:35PM
I thought as much from the description.

I've a great solution for those laptop users that move to new routers. I wrote a script that check the current routers MAC address and if it's changed any shared volumes are unmounted.

I run the script every minute in a launchd process. You can check out the script.

http://thefragens.com/pub/unmount.zip

[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: designr on May 22, '07 09:24:22AM

Have you tried unplugging your ethernet cable for a few seconds?



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: robg on May 22, '07 10:39:52AM

I didn't try that (I guess I'd have to turn off AirPort on the laptops). I'll try later today...

-rob.



[ Reply to This | # ]
Fastest solution..
Authored by: Chas on May 22, '07 09:40:40AM

I sometimes encounter this lockup when sharing files between my laptop and my desktop machine. The desktop is shut down or sleeping while my laptop is still connected, I go to use the laptop and it locks up upon Finder access.
I have found the fastest solution is to go reboot or wake the desktop, allowing the sharing machine to reconnect. Then eject the share, and go shut down/sleep the desktop machine again.
Yes this is totally lame. Apple better fix this in Leopard.



[ Reply to This | # ]
easiest solution...
Authored by: airdrummer on May 23, '07 05:28:48AM

don't let the sharing machine sleep;-)



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: jelockwood on May 22, '07 09:45:36AM

I have a similar problem.

I login to my laptop at work, put it to sleep, go out of the office, try to wake the laptop and get the SPOD (Spinning Wheel Of Death) for 10+ minutes.

Note: I am not logged in to any Shares but my office network does use an Auto-Mount of a Network Library folder. This is normally invisible to users but as far this problem counts it is still a share and still causes the SPOD in this situation. Also I do only use DHCP.

It [normally] does not cause a problem when I wake my laptop at home since at home I have a permanent VPN link to the office and so it can reconnect to the share without a problem.

If one is in a hurry one can force reboot the laptop (Control, Apple and Power), otherwise it is an [enforced] opportunity to go get a cup of tea.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: afragen on May 22, '07 03:57:14PM
I've got a solution to this one.

http://thefragens.com/pub/unmount.zip

I run a script in a launchd process every 60 seconds. The script checks to see if the router's MAC address is changed or if there is no network connection. If there's a change all afp and sshfs mounts are forcibly unmounted. Let me know if it works for you.

[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: marook on May 22, '07 11:10:16AM

Note: The linked logfile state to be 'consolelog.html'
All my entries about AFP stuff is in the systemlog!

---
/Marook



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: robg on May 23, '07 04:55:11AM

Hehe, that's just what I happened to name the HTML file -- it's in the same spot as yours in the actual logs :).

-rob.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: hamarkus on May 22, '07 11:52:54AM

Both with SMB and AFP shares I only get a lock-up after waking from sleep if I try to do something in the no-longer connected share, like trying to open a folder or trying to disconnect a share that no longer is available on the network.
My simple advice, if you 'forgot' to unmount a share before you put your computer to sleep, DO NOTHING, do not poke around in the folders of the share or try to disconnect it. The share will disconnect on its own after a minute or so and inform you about this with a small window.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: morespace54 on May 22, '07 01:38:44PM

I have this problem too (how ackward...)

I also found that when/if it happen, I don't touch/click/scroll anything and just wait (!) for the Finder. Then the lock-up time seems less long... but I use DHCP...



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: markuswarren on May 22, '07 01:44:14PM

Ah the joys of AFP :D

I've experienced this lovely delay, though I think it's been a lot less than 12 mins, maybe 3 - 5 at the most. Regardless of the length of time, it's very annoying to say the least. I find it happens when I've share open on my Server (OS X 10.4.9) and I sleep the server and then go to eject the share that is on my deskop. Wham! beachball time.

I'll try the sidebar trick next time I'm in this situation.

As to why it happens, perhaps the Finder is waiting for the operation to complete, whilst it does not do so when you eject from the sidebar. Nothing like a bit of consistency is there :D

It might be something to do with AFP3's reconnect facility, in that it's trying to reconnect to the server, though I don't think that is correct, as my understanding is that reconnect is meant to work along the lines of the share is alive, you sleep *your* machine and then wake it and the share will be reconnected.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: HugoV on May 22, '07 05:25:48PM

I use NFS at home (between 3 Macs and 2 Linux machines), and it's pretty reliable (provided you mount and unmount it manually from the terminal, rather than through Finder). If, on a laptop, you have the NFS server mounted, and go off the network (WiFi goes out of range etc), Finder will hang if you try and navigate to the server, but otherwise it's fine, and no other applications seem to be effected.

A related problem: all the network file system options (NFS, SMB, AFP, ...) on Mac OSX seem to be really poorly implemented and slow. Between two Macs directly connected to one another with a cross over cable, I can't seem to get more than a few megs/second over either AFP or SMB, and the CPU usage is really high (almost 100% on my old 867MHz PB G4). Between two 700 MHz Pentium 3 Linux boxes over either SMB or NFS, I can saturate the 100baseT network (i.e. 12.5 MB/second). Why is networking and Finder on Mac OS X still so poor??



[ Reply to This | # ]
35-50MB/s here
Authored by: pumilamac on Jul 03, '07 03:28:12AM

My old G4 Quicksilver Towers transfer files at about 35MB/s over AFP directly to each other. My newer G5 Towers (June 2004 and Late 2005) transfer at 50MB/s minimum over AFP on a home network switch.

I don't know if there is something wrong with your set up but it sure seems odd to me. I'm transferring lots of large files over the network (100-1000 MB per file) so it's not unusual for copies to take half and hour or so. If you're copying lots of small files it may be slower but I would think it would still hit 12MB/s.

Anyway here is another vote for fixing the hang when a network share is lost. Does anyone know if you can change the timeout setting?



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: dudemac on May 22, '07 06:13:58PM

I have seen this when trying to unmount a share after changing to a different wireless connection. I will try to run that script that checks the mac address and unmounts everything.

I figure that apple will eventually fix this, but I also thought that Tiger would have a fixed Finder but that didn't happen. I wish I was going to be getting a chance to see Leopard sooner, but I guess we will have to wait until September for that.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: blubbernaut on May 22, '07 07:34:58PM

We find this ridiculous lock up happens all the time if the remote computer is shutdown before the other user has a chance to eject them. Usually it's just the finder that locks up, but it's very frustrating and takes a very long time to finally throw up the message that "whatever computer has been disconnected".

There's got to be a better way.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: altimac on May 23, '07 02:41:46AM

This is simple:
This is my MAIN grip against OS X since 10.0. I've reported this bug in 2001 !

I hate my mac each time if close my powerbook lids and forgot that i had shares on my network.

Thanks for this tip, but Apple MUST fix that.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: schalliol on Jun 02, '07 11:15:34AM

I agree that this is one of the most anoying problems in OS X. I never sleep my servers [they're servers!], but I move from a home network with a NAS and a work network with a file server and have this problem in both directions if I forget to disconnect. I wrote an automator/AppleScript action to unmount or mount servers in each location, but that's a hassle.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: dan55304 on May 23, '07 07:54:31AM

Count me in too. I've disciplined my self to mount the share, get what I need, and get off. The real sad thing is waking a laptop. You just don't know if it's hung or busy.

This is such an annoyance I've avoided shared folders for years now. I've gone to USB drives whenever possible.

I realize Apple's trying to "help" here by reconnecting to mounted devices. They could just give drive errors like Windows, which is so user friendly. This time out, however, is ridiculous.

I think the best tip in this thread is to just leave it alone and let it go away on it's own.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: PaulIngraham on May 24, '07 10:50:46PM

Might as well throw in another bitter complaint. Naturally I was hopeful when I first saw this hint and all its comments that it might contain a solution to this old gripe, but I see that it's mainly just become a place to vent. So...

I am fortunate enough to live near the ocean. I take my MacBook outside, go sit by the water, work. Just about every damn time I open the MacBook, it hangs for minutes while it tries to find my iMac, because I forgot (again) to eject the share before leaving the house... and the sounds of cursing join the cries of seagulls and the surf.

There is so much good about Macs and OS X, but I really don't know how the Finder team can sleep at night. I would love to know what the story is behind Apple's neglect of the Finder. We'll probably never know. Meanwhile, it's absolutely embarassing explaining this stuff to switchers. "But... but..." they say, "that's just as stupid as Windows!" And I have to say, "It's actually even stupider in this particular case."

Sigh.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: shorts on May 30, '07 01:00:53AM

This happens to me when Im going back and forth between work with one MBP. If Im in a hurry, I just relaunch the finder.



[ Reply to This | # ]
Avoid a long system lockup related to sleeping shares
Authored by: ptejad on Jun 29, '07 11:19:22AM

I would suggest that anyone experiencing this problem go to http://bugreporter.apple.com and enter a bug report, and then update it each and every time you experience the issue, otherwise Apple may never do anything about it.



[ Reply to This | # ]