Skip to content

Commit

Permalink
Avoid deadlocking during DS health initialization
Browse files Browse the repository at this point in the history
There are some edge cases with restarting middleware in which
we can deadlock on the etc.generate lock for the kerberos group
if we're joined to AD (by calling into directoryservices.health.check
repeatedly). This fixes the issue by initializing the health state
if required when we first enter the directoryservices.health.check
method.
  • Loading branch information
anodos325 committed Jul 25, 2024
1 parent 35d17dc commit ba8f35a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ def check(self) -> bool:
if initial_status in (DSStatus.LEAVING, DSStatus.JOINING):
self.logger.debug("Deferring health check due to status of %s", initial_status.name)
return True
elif initial_status is None:
# Our directory service hasn't been initialized.
#
# We'll be optimistic and call it HEALTHY before we run the
# the actual health checks below. The reason for this is so that
# if we attempt to etc.generate files during health check a
# second call to directoryservices.status won't land us here again.
DSHealthObj.update(enabled_ds, DSStatus.HEALTHY, None)

try:
match enabled_ds:
Expand Down

0 comments on commit ba8f35a

Please sign in to comment.