Failed to lower process priority: set process group: operation not permitted

I get the following warning due to the new priority setting:

Failed to lower process priority: set process group: operation not permitted

This occurs when running Syncthing as a system service. Just for testing, I also tried it running as root (syncthing@root) and the same error occurs. The error does not happen when I run syncthing manually. So it seems systemd prevents some operation.

If this is not a problem on my side or there is no fix in the code (e.g. it’s simply a mystery what systemd does :wink: ), we could add an environment variable to disable the internal low priority thing and add it to the shipped systemd service files with the Nice option.

Can you post ps -ejH for that system when syncthing is running, at least the part of the tree that relates from systemd down to syncthing? I’m interested in the PID/SID/PGID relations here

If it is what I think it is, this might help; https://github.com/syncthing/syncthing/pull/4678

The syncthing process is directly below the main systemd process:

  PID  PGID   SID TTY          TIME CMD
[...]
    1     1     1 ?        00:07:58 systemd
[...]
14238 14238 14238 ?        00:00:34   syncthing

Right, so it’s already in it’s own session and process group, which is why the call fails. My patch above should work.

(It’s “neat” that it returns EPERM to indicate that the operation would be a no-op, but that’s the POSIX spec apparently…)

Yep, that works.

1 Like

Just to double check, does it actually manage to nice itself still?

1 Like

Yes it does.

1 Like

Just for reference: If you manually set the Nice option in the systemd service (like I do - I obviously disabled for testing), syncthing still warns about not being able to set niceness, but that’s expected and a user config problem, not syncthings problem (and the error message is nicely descriptive).

I think we should check for that and never attempt to raise our priority…

I have thought that falls into the too remote use case to be worth handling, but I won’t complain if works automatically :slight_smile:

As much as I want the bare minimum here, attempting to raise our priority and then complaining to the user is clearly a bug, compounded by then being annoying.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.