Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

[Disclaimer: I'm not an avid OS X user so I don't probably use the exact terminology or language]

I had a Mac Pro with Snow Leopard at work and I usually don't turn it off when going home. The next day, I always found my applications in the exact state where I had left them. Now, I have a new Mac Pro with Lion and every time I come back to work in the morning the system is locked down (i.e. I have to put my password), which is fine, and all applications are closed. They do however re-start and try to recover the state as I left them the day before. Alas, some applications crash (e.g. Mendeley, Quicksilver, Word), others don't succeed but let you recover the previous state (Chrome, Firefox), others simply dissappear (Emacs, scripts running). The thing that worries me the most is that when I leave work, I usually leave some simulations running that can take more than 12h to finish. I have lost work when I come back in the morning.

Question: what is going on here and how can I disable this "sleep/hibernate/???" behaviour.

I have already tried to change System Settings - Energy Saver - Computer and Display sleep to Never.

Update It turns out that this had nothing to do with resume. My mac is randomly shutting down sometimes and it happens almost every night. Now it has happened to me while working a couple of times and now I realize why I had a login screen every morning: it was just that the machine was turned off and back on. This is why some apps crashed (they were shut down incorrectly) and some others dissappeared (Emacs, scripts and simulation do not restart when logging back in).

share|improve this question

closed as not a real question by Mark, bmike Jan 14 '13 at 19:08

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
This sounds like the power is cut off somewhere during the night? –  Gerry Jun 5 '12 at 8:43
    
No, the login screen is not the same when you turn on/off... it's the one when you configure to enter password when display is locked –  YuppieNetworking Jun 5 '12 at 9:12
    
There is a feature in Lion (auto termination) which will close apps automatically based on memory need and idle time, but it only does that for apps that specifically support the feature. –  Gerry Jun 5 '12 at 9:21
    
If you leave the laptop plugged in, have energy saver set to never sleep, do not have scheduled shut down and boot up, and do not have "log out after …" set, then this shouldn't be happening. So double-check your settings and that your power is not being turned off at night. –  Old Pro Jun 8 '12 at 22:03
    
It's a Mac Pro... a huge 20kg block that even the Hulk wouldn't call a laptop :P –  YuppieNetworking Jun 8 '12 at 22:36
add comment

3 Answers 3

up vote 2 down vote accepted
+50

I suspect that Snow Leopard was hibernating while Lion is attempting to use it's Resume functionality, which has serious bugs. In particular, there are various applications like Preview that reliably break on Resume.

I'd imagine these Mac OS X centric applications you've listed all crash because they tell Lion they do resume, but their/Lion's resume simply doesn't work correctly. I forget if Snow Leopard offered Resume at all, but it treated resume far more conservatively if so.

You should therefore experiment with disabling resume. You could easily disable it system wide by unchecking Restore windows when opening and quitting apps in System Preference's General pane. Lion should then be forced into doing a full hibernate like Snow Leopard.

enter image description here

If this works, you could experiment with disabling resume for individual applications. You could prevent specific applications like Terminal, Preview, or you your simulation application from permitting resume using :

defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false
defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
...

There is some chance that Lion simply cannot write the resume files wherever they belong. You should therefore also repair permissions, make sure your drive has the 20% free that Lion requests, and plug in your time machine backup drive. I've never encountered any problem fixed by repair permissions, but maybe this once. There is a local time machine backup that Lion provides via that 20% free requirement. If this were full, maybe the resume files could not be written.

As an aside, there is a separate resume function built into Safari, Chrome, and a few others that doesn't require Lion's resume functionality. You'll should find their built in resume feature vastly more stable than Lion's efforts anyways.

share|improve this answer
    
So if the problem was with the resume functionality, what I need would be to disable the automatic logout, (which is not enabled, as commented in the post to Mike Meyers) ? Your post is informative, but I do not see how to relate this config to my own simulations (i.e. my own compiled code or shell scripts). –  YuppieNetworking Jun 8 '12 at 13:37
    
No, automatic logout is irrelevant. You aren't even "logged out" when you reenter your password, but more unlocking it. It simply happens that Lion implemented "lock system and conserve power" by closing all your application because they all told it they could restore/resume themselves. You must disable the restore/resume functionality so that Lion hibernates instead, just like Snow Leopard. –  Jeff Burdges Jun 8 '12 at 19:06
    
All laptops both sleep and hibernate, depending upon their situation, both technologies are well tested for over a decade and completely transparent for applications. Lion introduced this alternative resume/restore functionality that required additional integration with applications. Resume breaks ALL THE TIME, even with Apple's own applications like Terminal and Preview. –  Jeff Burdges Jun 8 '12 at 19:13
    
I've added an image depicting the button that controls Resume. –  Jeff Burdges Jun 8 '12 at 19:17
add comment

I think this is the feature of logging out after inactivity that can be set in System Preferences. This is in the General tab of the Security pane with the option of "Log out after ... minutes of inactivity".

An Apple page describing this feature is available here.

Additionally, this issue is described in another Stack Exchange question that I saw recently.

I'm only on my iPad so can't check this out at the moment but seems like it might be responsible.

share|improve this answer
    
I double checked and I have this feature disabled... thanks for the link anyway. –  YuppieNetworking Jun 8 '12 at 13:27
    
Just read the question again. So you're at the lock screen and not the login screen? Seems weird. Good luck getting it sorted. –  Mike Meyers Jun 8 '12 at 14:11
add comment

System Preferences -> Security & Privacy -> Advanced

Log out aftex xx minutes of inactivity

Can't post image :(

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.