Yes, rclone is now running with
oom_score_adj = -500. However, what we're setting with that is not the actual oom_score, it's just the amount by which the oom_score is supposed to be adjusted. I have no idea how the actual oom_score (before adjustment) is being calculated, but I suppose that is part of the OOM mystery you mentioned. From what I can see, we cannot set the absolute OOM score, only adjust whatever his majesty the OOM comes up with. And my understanding is that the OOM score for every process is continuously being updated based in divine insights.
I believe that one somewhat more transparent factor that goes into the OOM score is the process hierarchy, i.e. child processes are more likely to be killed than parents. I suppose this means that I may actually get different results when I run rclone from the terminal compared to running it as a cron-job. Or even when I run it with
nohup or without. Which can be quite disconcerting when you're troubleshooting and you believe you're doing the exact same thing...
Anyway, I am no longer surprised that rclone kept being killed because before I mad any adjustments, it had an OOM score of 667 or something like that. Yesterday, when I started rclone with
It got an OOM score of 334. So without the adjustement, the OOM was basically saying: you do not deserve to live. And when I checked this morning, it had even gone up to 440. So I increased the adjustment to -800. It's crazy.
Then again, all OOM scores need to be seen relative to the OOM scores of all other processes, I'm not sure what is the right way of getting a list of all OOM scores, but I do see a list of processes with their
dom_score_adj values in
dmesg and there I see that all
docker-proxy processes (which presumably are somehow each associated with one docker container) have an adjustment value of -500 and the
containerd-shim processes (which I assume stand for a docker container each) even have -998.
So someone (probably docker itself) is holding a protecting hand over all of my containers (although the processes running inside the containers don't have any adjustment) so that rclone, which I for some reason didn't put into a container, has a weak standing when the OOM comes by (most apps on my server run in containers).
Maybe I could have saved myself all these troubles if I had installed rclone in a container. I did try, though, but something didn't work (maybe it was the problem with rclone container not being accessible on the host itself?), so I went the supposedly easy way...
Anyway, I'll let this test instance of rclone run for now, and I hope it will just continue, but eventually I want to automate it again so that it starts on reboot. Running it as a system service seems the best way to go. I saw that
systemd has a setting called
OOMScoreAdjust which comes in handy...
Is there a recommended way of doing this (i.e. a config file)?