salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-master leaves a mess in /var/cache/salt/master/jobs

Open thekev opened this issue 13 years ago • 9 comments

Detailed Inode usage for: /var/cache/salt/master/jobs ... Total: 335487

This job cache alone used up 64% of my filesystem's available inodes. Master's config has keep_jobs at the default of 24 (hours).

We are running code from commit-id 42158cf.

thekev avatar Feb 10 '13 05:02 thekev

Thanks @thekev. We'll look into this.

UtahDave avatar Feb 12 '13 22:02 UtahDave

@thekev, you can lower the keep_jobs to one hour, or just turn off the cache altogether, these options should solve the problem

thatch45 avatar Feb 12 '13 22:02 thatch45

After clearing the cache and restarting the master, it seems to now be honoring keep_jobs=24. Here's another master that's being evil with 156k of them on disk. Code was not changed between 29 Jan and 9 Feb. It was restarted around 9 Feb though, where the garbage started getting cleaned up. It has always run as root. No funny permissions.

# find /var/cache/salt/master/jobs/ -type f | xargs stat | grep Modify | sort -nk2,3 | head -1
Modify: 2013-01-28 19:38:27.988597866 +0000

# find /var/cache/salt/master/jobs/ -type f | xargs stat | grep Modify | awk '{print $2}' | sort | uniq -c
    991 2013-01-28
   7418 2013-01-29
  11751 2013-01-30
  18494 2013-01-31
  13924 2013-02-01
  18414 2013-02-02
  15841 2013-02-03
   6460 2013-02-04
  13535 2013-02-05
  14968 2013-02-07
  20192 2013-02-08
   2052 2013-02-09
     54 2013-02-12
  12507 2013-02-13

Does the cleanup task only consider removing those that are precisely 24 hours old, vs >24h old? What if master was down for 24 hours (or otherwise non-functional/deadlocked, as we tend to see here and there)?

thekev avatar Feb 13 '13 13:02 thekev

Ahh, this makes me wonder if the cleanup process is dying, we had a problem with that for a few commits. And yes, it will clean out jobs older than 24 hours

thatch45 avatar Feb 14 '13 17:02 thatch45

So the cleanup process has state it needs to know what is old, it's not as simple as mtime > 24h. Need suspenders to supplement the belt?

thekev avatar Feb 14 '13 18:02 thekev

No, it is mtime > 24h, I bet that it was a bug in the cleanup process causing it to die, this should be fixed from the latest git

thatch45 avatar Mar 11 '13 03:03 thatch45

This looks fixed on my end, please reopen if this is not fixed

thatch45 avatar May 28 '13 23:05 thatch45

Is this issue resolved? I see this in version 2015.8.8.2 where the cache was not clearing up:

du -hs /var/cache/salt/master/*
16K /var/cache/salt/master/file_lists
2.8M    /var/cache/salt/master/gitfs
8.7M    /var/cache/salt/master/git_pillar
7.9G    /var/cache/salt/master/jobs
128K    /var/cache/salt/master/minions
0   /var/cache/salt/master/proc
0   /var/cache/salt/master/queues
0   /var/cache/salt/master/roots
0   /var/cache/salt/master/syndics
Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Oct 11 2015, 17:47:16)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 0.8.6
       cherrypy: 3.2.2
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: 0.21.0
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.21.4
   python-gnupg: Not Installed
          smmap: 0.8.1
        timelib: Not Installed

System Versions:
           dist: redhat 7.2 Maipo
        machine: x86_64
        release: 3.10.0-327.13.1.el7.x86_64
         system: Red Hat Enterprise Linux Server 7.2 Maipo

I have now updated the master to version 2016.3.1 and will keep an eye on the cache to see if the problem goes away.

Thanks

aabognah avatar Jul 12 '16 15:07 aabognah

yes, this is solved in 2016.3.0 and 2015.8.10. The original issue has long been resolved but we added extra cleanups in these versions to take care of stagnant directories

thatch45 avatar Jul 13 '16 19:07 thatch45