Author Topic: unable to save project (OSX 10.7, pi 1.7.6 - auto /tmp cleaning by apple)  (Read 5074 times)

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
i've had this happen to me a few times - both on my 10.6 machine and now on my 10.7 machine.

what happens is that after a while, apparently the OS is cleaning up files in /tmp and so some of the swap files go missing. when you try to save a project, PI just refuses to save the project when it can't find a .swp file in /tmp.

i just found this in google:

http://superuser.com/questions/187071/in-mac-os-x-how-often-is-tmp-deleted

looks like apple has a cron script that wipes out files that have not been accessed in quite a while. so either PI has to periodically touch all the files or move it's swap file storage to someplace safe, like ~/Library




Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
IMO that's a very unfortunate default behavior -  the files in /tmp are *your* working files, and nobody has the right to delete them without notice during the current session. Personally I would disable that "feature" immediately. That's why I don't like OS X - I want to have full control.

The solution to this problem, besides disabling the script in question (personally I'd remove it forever), is selecting a different swap directory in PixInsight:

- From the main menu, select Edit > Global Preferences.

- On the Preferences tool, select the Directories and Network section.

- In Swap storage directories, remove the default /tmp entry.

- Click Add and select a different directory.

- Press F6 or click the round button to apply globally.

Quote
or move it's swap file storage to someplace safe, like ~/Library

The logical place to store temporary files is /tmp. That's the purpose of /tmp after all. Having to use another directory for temporary storage because there is a script deleting temporary files just because they haven't been accessed in a while is a complete nonsense in my opinion.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Oops, perhaps I haven't understood the problem well. I've understood that the cron script in question deletes /tmp files at relatively short intervals, that is during the time you are processing your images with PixInsight.

But, are you saying that you are saving a project after three days or more working on it without closing PixInsight?  ???
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Oops, perhaps I haven't understood the problem well. I've understood that the cron script in question deletes /tmp files at relatively short intervals, that is during the time you are processing your images with PixInsight.


the script basically does a find for files with atime > 3 days ago, and deletes them. the /tmp directory (and all the BSD directories) are essentially invisible to the "normal" user. i happen to have been using unix since BSD 4.2 so i know something about what's under the hood, but Joe Mac User has no idea about this directory and so i'm sure apple are just trying to preserve the user experience. if some app fills up that directory with crap as far as Joe Mac User is concerned his disk just filled up for no reason, so they go and blow away the contents every so often.

http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW7

Quote
But, are you saying that you are saving a project after three days or more working on it without closing PixInsight?  ???

this is not uncommon for me, as almost by necessity all projects are multi-night projects. so i'll integrate in my latest subs and maybe process the integrated file for fun. if i remember, i'll save the project and quit PI. sometimes i get distracted and forget to save/quit. then 3 cloudy nights will go by and i've got new data. at that point i'm screwed because PI's swap files have mostly been deleted out from under it. can't save the project. the alternative is to revert to pre-project behavior and try to save each file individually... which is really a non starter.

i don't think you have much choice but to put the default swap directory somewhere else besides /tmp on OSX. you can't rely on the average user to even understand this problem, let alone go and disable the script. hell, on OSX it's not even cron anymore, it's launchd, which uses xml files as input. i'd have to go look up how to do it.





Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Hi Rob,

For 1.8, I'm planning a low-priority background task that accesses all swap files every hour. This should fix these issues for you long-term PI users :)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
thanks, yeah that should do it. hey you should be happy that we can get 3+ days of uptime these days!!

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
by the way, in case you don't want to move your PI swap location, or for some reason Juan's swap file touching does not work in 1.8, you can change apple's script to allow files to linger as long as you like in /tmp:

/etc/defaults/periodic.conf (10.7 and 10.8) contains a variable called "daily_clean_tmps_days" which is set to 3 by default. you can change this to anything you like (i picked 90).

prior to 10.7 the configuration file is in /etc/periodic.conf.

rob