tmp folder out of space issue

794 views
Skip to first unread message

shapeshed

unread,
Dec 3, 2009, 5:33:55 AM12/3/09
to Paperclip Plugin
I'm using Paperclip on mod_rails / Passenger to upload files of around
100MB to a server. I'm getting errors because the tmp folder is
filling up. The capacity of /tmp is 485M so it is not surprising that
issues are arising.

When the file makes it to the server it seems that two copies of the
file are made, then removed once the transfer has taken place. If
concurrent uploads happen it obviously runs out of space.

I am wondering if anyone else has come accross this problem before and
whether there is an elegant way to solve it. I've tried to set
Passenger Temp Directory using this
http://www.modrails.com/documentation/Users%20guide.html#_passengertempdir_lt_directory_gt

But I don't think Paperclip refers to this.

Basically is there any way I can change the temp folder to another one
with more capacity?

Ken Collins

unread,
Dec 3, 2009, 9:01:03 AM12/3/09
to papercli...@googlegroups.com

I believe it all boils down to what the ENV['TMPDIR'] is there are others that are checked, but that is the first one examined in the ruby lib tmpdir and from what I have found conforms to standard unix $TMPDIR. So, to make any ruby code that wants to know what temporary directory to use, you should be able to either set that on the server and/or in some rails pre initializer or init file.

- Ken
> --
> Individuals over processes. Interactions over tools.
>
> Agile Rails training from thoughtbot, the makers of Paperclip, Clearance, Shoulda, & Factory Girl:
> http://thoughtbot.com/services/training
>
> The Paperclip group:
> http://groups.google.com/group/paperclip-plugin
>
> To post to this group, send email to
> papercli...@googlegroups.com
>
> To unsubscribe from this group, send email to
> paperclip-plug...@googlegroups.com

shapeshed

unread,
Dec 7, 2009, 4:56:42 AM12/7/09
to Paperclip Plugin
Thanks Ken!

I used production.rb to set a custom TMPDIR for the rails app.

ENV['TMPDIR'] = '/path/to/your/custom/tmp'

There's some pretty heavy usage planned this week, so once I'm 100%
sure I'll do a quick blog post to document this for any other
developers.

On Dec 3, 2:01 pm, Ken Collins <k...@metaskills.net> wrote:
> I believe it all boils down to what the ENV['TMPDIR'] is there are others that are checked, but that is the first one examined in the ruby lib tmpdir and from what I have found conforms to standard unix $TMPDIR. So, to make any ruby code that wants to know what temporary directory to use, you should be able to either set that on the server and/or in some rails pre initializer or init file.
>
>  - Ken
>
> On Dec 3, 2009, at 5:33 AM, shapeshed wrote:
>
> > I'm using Paperclip on mod_rails / Passenger to upload files of around
> > 100MB to a server. I'm getting errors because the tmp folder is
> > filling up. The capacity of /tmp is 485M so it is not surprising that
> > issues are arising.
>
> > When the file makes it to the server it seems that two copies of the
> > file are made, then removed once the transfer has taken place. If
> > concurrent uploads happen it obviously runs out of space.
>
> > I am wondering if anyone else has come accross this problem before and
> > whether there is an elegant way to solve it. I've tried to set
> > Passenger Temp Directory using this
> >http://www.modrails.com/documentation/Users%20guide.html#_passengerte...
Reply all
Reply to author
Forward
0 new messages