Feh / nocache

minimize caching effects
BSD 2-Clause "Simplified" License
554 stars 53 forks source link

"transmission-gtk" freezes right after downloading because of "nocache" #36

Open beroal opened 6 years ago

beroal commented 6 years ago

When downloading of any torrent is complete, the program hangs. Then sending the SIGTERM signal does not terminate the Transmission process, only SIGKILL does. "transmission-gtk" does not freeze if I run it without "nocache". I checked this bug on 2 versions of "transmission-gtk". The version of "nocache" is 1.0.

Feh commented 6 years ago

SIGKILL can’t be blocked, so that’s not surprising.

I’ve never used “transmission”, could you try to reproduce this with a smaller program and/or a precise sequence of steps? A log of strace might be useful if you can’t get that – e.g. where is the program spending its time.

But before doing that, can you elaborate what you want to achieve? Did you read the README file where it says you can also limit the RAM usage of a program by putting it into a cgroup? That might be a more appropriate use case than the somewhat heavy-handed syscall intercept that nocache is doing.

beroal commented 6 years ago

Thanks, I will try "strace".

But before doing that, can you elaborate what you want to achieve?

Transmission is a BitTorrent client, so it reads a lot of data from the file system, mostly video. Second access to that data will probably be in a month, so there is no need to keep it in the file system cache.

Feh commented 6 years ago

I think using nocache is a bit misgueded here. Instead, if you’re concerned about cache thrashing by a BitTorrent client, I’d suggest executing the command in a cgroup with limited memory – you have all the benefits (LRU cache that caches the most useful stuff) without any of the downsides (using dlsym hacks that don’t reliably work).

beroal commented 6 years ago

A BitTorrent client is a typical situation where the LRU cache algorithm is inefficient. Least Recently Used time is not precise enough to represent real access frequency. So I help the program by disabling cache for specific directories (using my patch). I do not know how to achieve this with cgroups.