Comments (11)
Are you sure they're not cleaned up?
It uses the standard library Tempfile object and closes them, which eventually removes the file when the tempfile object is "finalized" (see the ruby tempfile doc)
from dragonfly.
The most bizarre things is the problem only appears if i use passenger. In my local system it's doesn't happen.
I think, Its a problem with my environment and my configs.
Tks
from dragonfly.
I saw in Ruby doc when we call close methods, the ruby doesn't unlink this file, he will wait for finalized. Possibly this may be the root cause of the problem.
I will try change to "close!" and test.
from dragonfly.
I'll close this if that's ok - I don't think there's an issue here - let me know if otherwise
from dragonfly.
Hi, I had this issue too. The problem can be solved if you unlink the Tempfile when you close it.
Tempfiles accept a flag to do this on close (true/false). I had to put this on my app to avoid my /tmp directory to explode with non closed files:
Dragonfly::TempObject.class_eval do
def close(*)
@tempfile.close(true) if @tempfile
end
end
That ensures the actual file on the file system is unlinked as soon as possible.
from dragonfly.
Hello,
We've been having this issue too. We tracked a problem with apps on heroku crashing thanks to this bug report. Dragonfly was filling up the tmp folder to Heroku's limit. Emmanuel's patch has fixed the problem for us.
Cheers
Steve
from dragonfly.
Hi
thanks for the patch - I've added this (or something equivalent) in the new version 0.9.3 3b7578e
Bear in mind though, that this only cleans up the tempfile that gets finally served (it works because Rack handlers have a line "body.close if body.respond_to?(:close)").
If you have a chain of processing (e.g. image.thumb('400x400').gif), then any intermediate tempfiles created will still be cleaned up later by the garbage collector.
It would not be right to unlink these ones straight away because you haven't necessarily finished with them yet. If it's still a problem let me know and maybe I'll have to put in some way of keeping track of all the created tempfiles then unlinking before serving.
cheers
Mark
from dragonfly.
txs. My patch seemed to fix things "for a while". Soon, tmp files started to appear anyway, which I found strange. I'll try your version seems you seem to be doing more than just unlinking on close. Will let you known if I'm still having the issue.
from dragonfly.
my version doesn't really do much more than that (I just added tests and dealt with a couple of edge cases), so you will probably find the same.
Like I said though, even those tmp files should be cleaned up eventually when they are garbage collected - but if it's causing problems, then there is probably a way of cleaning all them up by keeping track of intermediate tempfiles and closing all of them when Rack calls 'close' on the response body
from dragonfly.
ok that would be awesome.
from dragonfly.
OK tempfiles are cleaned up immediately now (version 0.9.4) for GET requests to Dragonfly.
note that HEAD requests to Dragonfly and other uses (e.g. calling image.thumb('50x50').data) still rely on garbage collection for cleaning up, but you can manually call Job#close if you need to (though you shouldn't need to!)
Please let me know if it works/doesn't work!
Thanks
Mark
from dragonfly.
Related Issues (20)
- Default content auto-whitelist doesn't work with FileDataStore
- Can't store resized pdf as jpg HOT 5
- Requesting filename without download file for custom stores HOT 2
- Turning Off Logs HOT 1
- Dragonfly unit test cases failing in Rails 4 HOT 1
- Dragonfly::FileDataStore::UnableToFormUrl: you need to configure server_root for Dragonfly::FileDataStore in order to form urls
- How to ignore "Dragonfly::FileDataStore destroy error"?
- Adding the ability to specify headers for a URL based attachment HOT 3
- Fetching url in the background
- after_assign's copy_to doesn't fire when using retained_image HOT 1
- SSL verification mode option
- warning: loading in progress, circular require considered harmful HOT 1
- is this version of Dragonfly compatible ? HOT 4
- Support for posix-spawn? HOT 2
- Security Issue Report HOT 1
- Guidance on upgrading to 1.4.0 HOT 7
- validate problems?
- CSS style color raising InvalidParameter when using plain generator HOT 1
- Questions about GHSA-qrgf-jqqm-x7xv HOT 2
- Allowing quality and interlace params for imagemagick thumb processor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dragonfly.