Temp file conflicts
Has anyone worked on a way to prevent two Drupal sites on a single server from using the same temporary directory? Conflicts when multiple sites add the same files to /tmp affect Chat Room and XML Site Map.
Yeah, there is a setting for it with the file storage path. On Wed, 2007-07-04 at 18:16 -0400, Darren Oh wrote:
Has anyone worked on a way to prevent two Drupal sites on a single server from using the same temporary directory? Conflicts when multiple sites add the same files to /tmp affect Chat Room and XML Site Map.
Op donderdag 05 juli 2007, schreef Darrel O'Pry:
Yeah, there is a setting for it with the file storage path.
On Wed, 2007-07-04 at 18:16 -0400, Darren Oh wrote:
Has anyone worked on a way to prevent two Drupal sites on a single server from using the same temporary directory? Conflicts when multiple sites add the same files to /tmp affect Chat Room and XML Site Map.
I have this path hardcoded in the settings.php for all the sites on the server. The settings hardcode tmp dirs to in /path/to/Drupal/sites/example.com/files/tmp. that way they a) use up the diskspace for one account. b) cannot be changed to path/to/drupal/modules/node/ (what happens when someone changes it to that and uploads a node.module file.... yup, your probably rooted then) c) no 'nobody's as file owners and other nasty /tmp hacks possible. d) require /only/ files to be writable. Bèr -- Drupal, Ruby on Rails and Joomla! development: webschuur.com | Drupal hosting: www.sympal.nl
Quoting Darren Oh <darrenoh@sidepotsinternational.com>:
Has anyone worked on a way to prevent two Drupal sites on a single server from using the same temporary directory? Conflicts when multiple sites add the same files to /tmp affect Chat Room and XML Site Map.
I haven't worked on a way but possibilities exist. The one I see working best is to move the files directory to the sites directory. So if I have sample1.com and sample2.com; sites/sample1.com/files and sites/sample2.com/files would separate them. Earnie
Earnie Boyd wrote:
I haven't worked on a way but possibilities exist. The one I see working best is to move the files directory to the sites directory. So if I have sample1.com and sample2.com; sites/sample1.com/files and sites/sample2.com/files would separate them.
That is best practice for the files directory, but he was asking about the tmp directory which is different. I was using /tmp/sample1.com and /tmp/sample2.com, but just ran into an issue where if that subdir got removed by some process or server restart, CSS/JS aggregator would completely barf with the file /tmp/FJKdkjfsldjf could not be moved to files/css/34jk3l4j2k34j34.css because it is not configured properly. Bad error message as it really means that /tmp/sample1.com folder needs to be created. I just created an issue for this at http://drupal.org/node/157134 so I remember. -Rob
On 7/5/07, Rob Barreca <rob@electronicinsight.com> wrote:
Earnie Boyd wrote:
I haven't worked on a way but possibilities exist. The one I see working best is to move the files directory to the sites directory. So if I have sample1.com and sample2.com; sites/sample1.com/files and sites/sample2.com/files would separate them.
That is best practice for the files directory, but he was asking about the tmp directory which is different. I was using /tmp/sample1.com and /tmp/sample2.com, but just ran into an issue where if that subdir got removed by some process or server restart, CSS/JS aggregator would completely barf with the file /tmp/FJKdkjfsldjf could not be moved to files/css/34jk3l4j2k34j34.css because it is not configured properly.
Bad error message as it really means that /tmp/sample1.com folder needs to be created. I just created an issue for this at http://drupal.org/node/157134 so I remember.
Um. Or just put "tmp" at /sites/example.com/tmp .... -- Boris Mann Office 604-682-2889 Skype borismann http://www.bryght.com
On Jul 5, 2007, at 5:05 PM, Boris Mann wrote:
Um. Or just put "tmp" at /sites/example.com/tmp ....
Then it wouldn't be a temp directory. Files would keep accumulating until someone got around to clearing out the directory. The reason I keep my temp directory under /tmp is that my OS automatically clears it out now and then.
On 7/5/07, Darren Oh <darrenoh@sidepotsinternational.com> wrote:
On Jul 5, 2007, at 5:05 PM, Boris Mann wrote:
Um. Or just put "tmp" at /sites/example.com/tmp ....
Then it wouldn't be a temp directory. Files would keep accumulating until someone got around to clearing out the directory. The reason I keep my temp directory under /tmp is that my OS automatically clears it out now and then.
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files..... -- Boris Mann Office 604-682-2889 Skype borismann http://www.bryght.com
On Jul 5, 2007, at 5:18 PM, Boris Mann wrote:
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files.....
Enough "Um"s! I respect your contributions to Drupal, but you seem to be the only person who thinks this is an unreasonable feature.
On 7/5/07, Darren Oh <darrenoh@sidepotsinternational.com> wrote:
On Jul 5, 2007, at 5:18 PM, Boris Mann wrote:
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files.....
Enough "Um"s! I respect your contributions to Drupal, but you seem to be the only person who thinks this is an unreasonable feature.
Or, rather than the only one to feel that way, Boris is just the first person to say so.
On 7/5/07, andrew morton <drewish@katherinehouse.com> wrote:
On 7/5/07, Darren Oh <darrenoh@sidepotsinternational.com> wrote:
On Jul 5, 2007, at 5:18 PM, Boris Mann wrote:
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files.....
Enough "Um"s! I respect your contributions to Drupal, but you seem to be the only person who thinks this is an unreasonable feature.
Or, rather than the only one to feel that way, Boris is just the first person to say so.
Didn't say unreasonable, just there are many ways around this. Have your modules create subdirectories. Anything in a tmp folder (esp! /tmp) is not guaranteed to stick around at all. If you set it to be somewhere under your control (i.e. not /tmp), then it won't get removed and you can make subfolders and all that other good stuff. -- Boris Mann Office 604-682-2889 Skype borismann http://www.bryght.com
Although my issue at http://drupal.org/node/157134 still stands for files and tmp dirs. But you are correct, you can use sites/sample1.com/tmp and I've done this before. But I just like have the tmp files above the docroot maybe just for my own warm, fuzzy feeling. :) -R Boris Mann wrote:
On 7/5/07, andrew morton <drewish@katherinehouse.com> wrote:
On 7/5/07, Darren Oh <darrenoh@sidepotsinternational.com> wrote:
On Jul 5, 2007, at 5:18 PM, Boris Mann wrote:
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files.....
Enough "Um"s! I respect your contributions to Drupal, but you seem to be the only person who thinks this is an unreasonable feature.
Or, rather than the only one to feel that way, Boris is just the first person to say so.
Didn't say unreasonable, just there are many ways around this. Have your modules create subdirectories. Anything in a tmp folder (esp! /tmp) is not guaranteed to stick around at all.
If you set it to be somewhere under your control (i.e. not /tmp), then it won't get removed and you can make subfolders and all that other good stuff.
On 7/5/07, Rob Barreca <rob@electronicinsight.com> wrote:
Although my issue at http://drupal.org/node/157134 still stands for files and tmp dirs. But you are correct, you can use sites/sample1.com/tmp and I've done this before. But I just like have the tmp files above the docroot maybe just for my own warm, fuzzy feeling. :)
You can have them above the docroot, too -- e.g. /notdocroot/some/site/hierarchy/site.com/tmp It's a full path, IIRC. -- Boris Mann Office 604-682-2889 Skype borismann http://www.bryght.com
On Thu, 2007-07-05 at 16:58 -0700, Boris Mann wrote:
On 7/5/07, Rob Barreca <rob@electronicinsight.com> wrote:
Although my issue at http://drupal.org/node/157134 still stands for files and tmp dirs. But you are correct, you can use sites/sample1.com/tmp and I've done this before. But I just like have the tmp files above the docroot maybe just for my own warm, fuzzy feeling. :)
You can have them above the docroot, too -- e.g. /notdocroot/some/site/hierarchy/site.com/tmp
It's a full path, IIRC.
And if you get really paranoid you can write a cron that cleans out any files in your temp tree... I think it looks some thing like `find /path/to/temps --mtime=+someamountoftime {rm}` iirc, I really need man to get it right. You could also write a cron hook to clean out your temp dirs.. I feel there was one proposed at one time.
I believe my original question has been answered. To summarize, 1) no work has been done to prevent the same temp directory from being chosen for two different sites, and 2) there is an active issue (http://drupal.org/node/157134) to deal with the problem of the temp directory being deleted when it is a subdirectory of /tmp.
To summarize: It's a configuration issue, configure your site properly. The temp path is on the settings page for a reason. Giving 2 sites the same files path breaks all kinds of stuff as well. You can also look for functions that are writing files to you temp path without using tempnam(). I know there is probably a lot of stuff that still does that, and I am likely guilty. :) IIRC even php's session clean up is normally a cron job. On Thu, 2007-07-05 at 22:26 -0400, Darren Oh wrote:
I believe my original question has been answered. To summarize,
1) no work has been done to prevent the same temp directory from being chosen for two different sites, and 2) there is an active issue (http://drupal.org/node/157134) to deal with the problem of the temp directory being deleted when it is a subdirectory of /tmp.
On 7/5/07 5:26 PM, Darren Oh wrote:
On Jul 5, 2007, at 5:18 PM, Boris Mann wrote:
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files.....
Enough "Um"s! I respect your contributions to Drupal, but you seem to be the only person who thinks this is an unreasonable feature.
I think part of the problem is that you're using /tmp in a way that is not entirely intended. From PHP's perspective - /tmp is only for things that last a single invocation (i.e. single HTTP request). I think, if you're going to use system-wide temp space, you need to realize that and look at something like: http://ca3.php.net/tempnam and read about proper temp space usage. Otherwise, follow the other suggestions about using per-site temp space and then clean up after yourself. -- James Walker :: http://walkah.net/ :: xmpp:walkah@walkah.net
Quoting Darren Oh <darrenoh@sidepotsinternational.com>:
On Jul 5, 2007, at 5:18 PM, Boris Mann wrote:
Um. No. It really is temporary. The file gets removed by the operations that happen. They are temporary files.....
Enough "Um"s! I respect your contributions to Drupal, but you seem to be the only person who thinks this is an unreasonable feature.
Darren, I think you misunderstand Boris. Process creates temp file. Process deletes temp file. On some systems the files could be opened as delete on close; even on windows. This would keep the system clean regardless of if the process is interrupted before deleting the file. Earnie
participants (8)
-
andrew morton -
Boris Mann -
Bèr Kessels -
Darrel O'Pry -
Darren Oh -
Earnie Boyd -
James Walker -
Rob Barreca