QW-Group / mvdsv

MVDSV: a QuakeWorld server
GNU General Public License v2.0
58 stars 56 forks source link

[BUG] sv_demoClearOld doesn't work #135

Closed tarbugre closed 1 month ago

tarbugre commented 2 months ago

Describe the bug I have set sv_demoClearOld and sv_demoMaxDirSize but it just doesn't work

To Reproduce Steps to reproduce the behavior: 1- Set sv_demoMaxDirSize 2048000 2- Set sv_demoClearOld 10
3- Play a lot and see your demo dir size surpass 2gb

Expected behavior Everytime that the dirsize reaches 2gb delete the last 10 demos

What actually happens Nothing

Environment(please complete the following information):

Operation System: [e.g. Windows, Linux, ...]: Ubuntu 20.04.3 LTS" Processor Architecture: [e.g. x86, x86_64, arm7, ...] x86-64 MVDSV Version: mvdsv 0.35 antilag r115 KTX Version: 1.41 beta antilag r115

Additional context sv_demoremove *token also has bugs, so no tools provided by mvdsv work to do demo maintenance, have to delete the files manually

ciscon commented 2 months ago

i can't replicate this issue on master, i created a 1 gig mvd and threw it in alongside a handful of other demos, set my sv_demomaxdirsize to 1 gig, and when i start a match: sv_demoClearOld [2024-05-10 12:51:02] "sv_demoClearOld" is "10" sv_demomaxdirsize [2024-05-10 12:51:05] "sv_demoMaxDirSize" is "1024000" [2024-05-10 12:51:08] ciscon is ready [2024-05-10 12:51:08] All players ready [2024-05-10 12:51:08] Timer started [2024-05-10 12:51:08] QiZmo: timer lag point disabled [2024-05-10 12:51:08] Clearing 10 old demos

mushis commented 2 months ago

maybe permissions..?

ciscon commented 2 months ago

you'd think it wouldn't be writing the things in the first place if it were permissions, but you never know when it comes to more advanced stuff like extended attributes/selinux (though i doubt that's an issue on a default ubuntu install).

ciscon commented 2 months ago

are there more than 4096 demos in there? it will stop counting at that number so if the size limit isn't hit with a bunch of tiny demos you're sol and have to clear out stuff manually.

ciscon commented 2 months ago

so it turns out there was an overflow when calculating the space used (thanks @spoike) but being that you're on the antilag stuff, you'd need to manually merge the fix in (assuming it's that issue you're hitting and not the file limit).

tarbugre commented 2 months ago

are there more than 4096 demos in there? it will stop counting at that number so if the size limit isn't hit with a bunch of tiny demos you're sol and have to clear out stuff manually.

You've got it! ubuntu@ip-xxx-xxx-xxx-xxx:~/nquakesv/ktx/demos$ ls | wc -l 8113

PS: I just manually deleted some. I wrote a script to delete demos older than 60 days

We have a lot of "end" matches, so tiny demos

ciscon commented 2 months ago

fyi, if you want to archive the stuff it's better to do it yourself anyway, i have a cronjob like this:

20 6 4 root nice -n20 rsync -a /mnt/nas-quake/demos/*.mvd /mnt/nas-quake/demos_backup/nicotinelounge/. >/dev/null 2>&1 && nice -n20 find /mnt/nas-quake/demos -mtime +30 -print0|xargs -r -0 rm -f >/dev/null 2>&1