litespeedtech / litespeedtech/openlitespeed

Swap is filling up - TTL is set to 3600, but files is not deleted on regular basis after TTL expiry

Open
#316 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.5k
Forks
233
Avg merge
2d 19h
Merged PRs (30d)
5

Description

Hi,

My lshttpd/swap folder is filling up, due to unique minified CSS-files (and JS, but that's temporary fixed).

_I know I changed something on the server at the 2022-05-16 which forced it to generated far many unique minified filed, but I'd expect OLS to clean up the cache/swap-files after the TTL is passed/expired, or checked regularly on a daily/hourly interval or so._

In LSCWP I've defined the TTL to a max of 3600, so this is part of my config:
```

ExpiresActive on
ExpiresByType application/pdf A3600
ExpiresByType image/x-icon A3600
ExpiresByType image/vnd.microsoft.icon A3600
ExpiresByType image/svg+xml A3600

ExpiresByType image/jpg A3600
ExpiresByType image/jpeg A3600
ExpiresByType image/png A3600
ExpiresByType image/gif A3600
ExpiresByType image/webp A3600

ExpiresByType video/ogg A3600
ExpiresByType audio/ogg A3600
ExpiresByType video/mp4 A3600
ExpiresByType video/webm A3600

ExpiresByType text/css A3600
ExpiresByType text/javascript A3600
ExpiresByType application/javascript A3600
ExpiresByType application/x-javascript A3600

ExpiresByType application/x-font-ttf A3600
ExpiresByType application/x-font-woff A3600
ExpiresByType application/font-woff A3600
ExpiresByType application/font-woff2 A3600
ExpiresByType application/vnd.ms-fontobject A3600
ExpiresByType font/ttf A3600
ExpiresByType font/otf A3600
ExpiresByType font/woff A3600
ExpiresByType font/woff2 A3600

```

In OLS > Module > Cache, I'm using the following config:
```
checkPrivateCache 1
checkPublicCache 1
maxCacheObjSize 10000000
maxStaleAge 200
qsCache 1
reqCookieCache 1
respCookieCache 1
ignoreReqCacheCtrl 1
ignoreRespCacheCtrl 0

enableCache 0
expireInSeconds 3600
enablePrivateCache 0
privateExpireInSeconds 3600
```

But the server is still growing in size, with files much older than 3600 sec:
```
[root@production swap]# find . -maxdepth 3 -type f -printf '%TY-%Tm %s\n' | awk '{b[$1]+=$2} END{for (date in b) printf "%s %5.1f MiB\n", date, b[date]/1024**2}' | sort
2020-01 0.0 MiB
2020-04 0.4 MiB
2020-08 0.1 MiB
... (removed)
2022-02 0.8 MiB
2022-03 0.7 MiB
2022-04 0.3 MiB
2022-05 6603.1 MiB

[root@production swap]# find . -maxdepth 3 -type f -printf '%TY-%Tm-%Td %s\n' | awk '{b[$1]+=$2} END{for (date in b) printf "%s %5.1f MiB\n", date, b[date]/1024**2}' | sort
2020-01-11 0.0 MiB
2020-04-01 0.4 MiB
2020-08-12 0.1 MiB
... (removed)
2022-05-13 0.0 MiB
2022-05-14 0.4 MiB
2022-05-15 0.4 MiB
2022-05-16 305.8 MiB
2022-05-17 671.2 MiB
2022-05-18 649.7 MiB
2022-05-19 644.9 MiB
2022-05-20 691.2 MiB
2022-05-21 709.9 MiB
2022-05-22 562.6 MiB
2022-05-23 551.9 MiB
2022-05-24 502.2 MiB
2022-05-25 477.2 MiB
2022-05-26 601.8 MiB
2022-05-27 232.9 MiB
```

More details here:
https://golitespeed.slack.com/archives/C3QRCDP44/p1653642082393049

**Problems/Questions**

1) Shouldn't the old swap files be removed on regularly basis?

2) Is there a "problem" with my current setup, of is this the expected outcome?

3) If so, how should I process from here to keep the cached files to a more limited amount (x days old)?

**System info**
`OpenLiteSpeed 1.7.15 `
LiteSpeed Cache Report Number: `PYBWTPVS` (if the details helps with any debugging)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported growth in the lshttpd/swap directory using the supplied OpenLiteSpeed 1.7.15 cache settings and the find/awk age reports. Trace the cache cleanup path for files older than expireInSeconds 3600, then confirm whether regular cleanup occurs and document the observed behavior or required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.