Skip to content

systemd: relaunch sssd after unclean exit#8407

Merged
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
Squiddim:master
Feb 19, 2026
Merged

systemd: relaunch sssd after unclean exit#8407
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
Squiddim:master

Conversation

@Squiddim

@Squiddim Squiddim commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

This PR aims to fix #6219 by swapping the restart policy of the sssd systemd unit back to on-failure.

The change to Restart=on-abnormal was introduced in Commit a049ac7 to fix an infinite loop on system boot caused by misconfiguration (see #5753 / https://bugzilla.suse.com/show_bug.cgi?id=1188999).

While this fixed their issue, I'd argue that the StartLimit settings introduced alongside it should accomplish the goal of avoiding an infinite loop in most scenarios:

     StartLimitIntervalSec=50s
     StartLimitBurst=5

I believe that the issues fixed (#6219) by setting the restart policy back to on-failure take precedence over the edge cases where sssd could inhibit system boot when sssd/subsystems are too slow to trigger the StartLimit.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request changes the systemd Restart policy for sssd from on-abnormal to on-failure. This aims to address issue #6219 by allowing sssd to restart in more failure scenarios, including watchdog kills. The author acknowledges that on-abnormal was previously introduced to prevent infinite restart loops due to misconfiguration, and argues that existing StartLimit directives should mitigate this risk. However, there's a potential for the original issue to re-emerge in certain edge cases if the StartLimit configuration is not fully comprehensive.

Comment thread src/sysv/systemd/sssd.service.in

@aplopez aplopez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree with @Squiddim My tests show that StartLimitIntervalSec and StartLimitBurst are enough.
However, I'd like a second opinion on this change before merging it.

@alexey-tikhonov alexey-tikhonov added the no-backport This should go to target branch only. label Feb 4, 2026
@alexey-tikhonov

Copy link
Copy Markdown
Member

This PR aims to fix #6219

Please add 'Resolves: #6219' line to the commit message.

@alexey-tikhonov

Copy link
Copy Markdown
Member

I'd argue that the StartLimit settings introduced alongside it should accomplish the goal of avoiding an infinite loop in most scenarios:

     StartLimitIntervalSec=50s
     StartLimitBurst=5

IIUC, this limits the rate and allows boot to proceed, but it doesn't prevent infinite loop.

I would suggest to make sure 'sssd' exit due to internal watchdog has unique exit code and then use RestartForceExitStatus for this code.

@Squiddim

Squiddim commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

IIUC, this limits the rate and allows boot to proceed, but it doesn't prevent infinite loop.

Well it should stop an infinite loop when sssd manages to exit 5 times in the configured 50 seconds.
If it's too slow, for example because of a slow LDAP server, I guess you could still end up in an infinite loop, but the adjusted restart policy does not change anything about that, so I'd say it's something to be looked at separately.

@alexey-tikhonov

Copy link
Copy Markdown
Member

If it's too slow, for example because of a slow LDAP server

Broken DNS (unresponsive server), for example.

All the complains in #6219 are about restart after internal watchdog.
That's why I think handling this case explicitly is safer.

@alexey-tikhonov alexey-tikhonov self-assigned this Feb 5, 2026
@Squiddim

Squiddim commented Feb 5, 2026

Copy link
Copy Markdown
Contributor Author

All the complains in #6219 are about restart after internal watchdog.
That's why I think handling this case explicitly is safer.

I see where you come from but what exit code would you define in RestartForceExitStatus ?
lemme explain what i mean...

In the Issue #6219 people see was terminated by own WATCHDOG which IIUC would correspond to Exit Code 70?
see SSS_WATCHDOG_EXIT_CODE constant and the was terminated by own WATCHDOG message here

However the exit code that systemd gets differs from case to case.

Some examples, unfortunately not a lot of people have shown their journalctl -u sssd output :/

  1. In the other PR systemd: Restart=on-failure #8408 you can see exit 1:
Jan 26 17:53:06 ### sssd[1537]: Child [921930] ('###':'###') was terminated by own WATCHDOG. Consult corresponding logs to figure out the reason.
Jan 26 17:53:36 ### sssd_nss[921939]: Starting up
Jan 26 17:53:38 ### sssd[1537]: Exiting the SSSD. Could not restart critical service [nss].
Jan 26 17:53:38 ### sssd_be[921937]: Starting up
Jan 26 17:53:59 ### sssd_be[921937]: Shutting down (status = 0)
Jan 26 17:54:03 ### sssd_pac[921910]: Shutting down (status = 0)
Jan 26 17:54:08 ### systemd[1]: sssd.service: Main process exited, code=exited, status=1/FAILURE
  1. This Person does not state the exact code but nonzero:
    sssd don't restart properly after being killed by watchdog #6219 (comment)

  2. I myself have encountered exit 6 (and others which I cant find anymore):

Jan 09 00:04:08  sssd[3797703]: Child [2807075] ('ldap':'%BE_ldap') was terminated by own WATCHDOG. Consult corresponding logs to figure out the reason.
Jan 09 00:04:08  sssd[3797703]: Exiting the SSSD. Could not restart critical service [ldap].
Jan 09 00:04:08  sssd_pam[3797706]: Shutting down (status = 0)
Jan 09 00:04:08  sssd_nss[3797705]: Shutting down (status = 0)
Jan 09 00:04:08  systemd[1]: sssd.service: Main process exited, code=killed, status=6/ABRT

So ultimately there are many different scenarios like high cpu load, high io load, someone said it started after he saw oom messages etc... which result in different non-zero exit codes.

From my perspective as a sysadmin I would want SSSD to be restarted in any of them and for the unrecoverable ones we have a backoff mechanism

     StartLimitIntervalSec=50s
     StartLimitBurst=5

@aplopez

aplopez commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

@Squiddim
@alexey-tikhonov proposes to modify SSSD's code to always return a well-known return code when terminated by the watchdog, and then use this return code in the RestartForceExitStatus.

I think this might work.

@alexey-tikhonov

Copy link
Copy Markdown
Member

@alexey-tikhonov proposes to modify SSSD's code to always return a well-known return code when terminated by the watchdog, and then use this return code in the RestartForceExitStatus.

Right, that's what I meant (though required code modification and testing might be not so trivial).

But good point made is that this wouldn't cover OOM case, that also needs automatic restart.

@pbrezina

Copy link
Copy Markdown
Member

If it's too slow, for example because of a slow LDAP server

Broken DNS (unresponsive server), for example.

But in this case sssd starts in offline mode, it is not terminated., or is it?

All the complains in #6219 are about restart after internal watchdog. That's why I think handling this case explicitly is safer.

How about going the other way around and use on-failure and RestartPreventExitStatus= to prevent restarts when SSSD cannot really start (misconfiguration)... but then again these cases would be covered by the burst configuration.

@alexey-tikhonov

Copy link
Copy Markdown
Member

If it's too slow, for example because of a slow LDAP server

Broken DNS (unresponsive server), for example.

But in this case sssd starts in offline mode, it is not terminated., or is it?

Main SSSD process ('monitor') has hard coded timeout of 7 seconds for starting up all 'sssd_be' processes.
If 'sssd_be' can't resolve own hostname, it doesn't report to 'monitor' it started and thus gets terminated.

Resolves: SSSD#6219
Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Alejandro López <[email protected]>
@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeQL (success)
🟢 osh-diff-scan:fedora-rawhide-x86_64:upstream (success)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Analyze (target) / cppcheck (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)
➖ ci / intgcheck (skipped)
🔴 ci / prepare (failure)
➖ ci / system (skipped)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@alexey-tikhonov
alexey-tikhonov merged commit b433605 into SSSD:master Feb 19, 2026
7 of 8 checks passed
@nolta

nolta commented Mar 5, 2026

Copy link
Copy Markdown

We tried this out on Rocky9.7, but unfortunately it doesn't seem to fix #6219 for us (we're having the same problem as this comment).

@c7b3rx

c7b3rx commented Jul 7, 2026

Copy link
Copy Markdown

it doesn't solve the problem

@alexey-tikhonov

Copy link
Copy Markdown
Member

We tried this out on Rocky9.7, but unfortunately it doesn't seem to fix #6219 for us (we're having the same problem as this comment).

it doesn't solve the problem

Unfortunately, those comments are useless without logs and in the closed PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted no-backport This should go to target branch only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sssd don't restart properly after being killed by watchdog

7 participants