Don't Get Bitten by Chef Bug #1397

September 22, 2010

CHEF-1397 describes a problem where the Chef client creates a bunch of temporary files under /var/cache/chef/checksums/ but never deletes them. In the short term, this will lead to extremely slow Chef runs, but it can ultimately result in your servers running out of inodes or disk space if you’re not paying close attention.

I actually discovered this problem a few months back when I was running Chef 0.8.6, but since it still seems to be a problem in the recently-released 0.9.8, I figured I’d document my quick fix:

            # FIXME: http://tickets.opscode.com/browse/CHEF-1397
            execute "clean_cache" do
              command "/usr/bin/find /var/cache/chef/checksums/ -maxdepth 1 -type f -ctime +1 -delete"
            end
            

I added this to my chef::client recipe so that it gets executed every time Chef runs. This cut my Chef run times down from several tens of seconds to about 5 seconds.

blog comments powered by Disqus