-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release lease on shard stop #31716
Release lease on shard stop #31716
Conversation
@@ -1181,6 +1181,7 @@ private[akka] class Shard( | |||
|
|||
override def postStop(): Unit = { | |||
passivateIntervalTask.foreach(_.cancel()) | |||
lease.foreach(_.release()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need something similar in ClusterSingleton or can that transition be trusted to be run on postStop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It releases in two of the state transitions (from Oldest to any other state, from AcquiringLease to anything but Oldest), I just checked that there is something there, did not investigate if there is anything incorrect with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it will pass through these transitions for example in case of ActorSystem termination. Maybe there is already something else that would release the lease in case of ActorSystem termination?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some heartbeat and timeout settings (by default every 12 seconds and a timeout of 120s) https://github.com/akka/akka/blob/main/akka-coordination/src/main/resources/reference.conf#L14
And then again a separate setting in the management api k8 lease:
https://github.com/akka/akka-management/blob/main/lease-kubernetes/src/main/resources/reference.conf#L36
However, I don't see that we ever do anything with those timeout/ttl settings, neither in akka-coordination nor the K8 lease impl in akka-management. I'd expect we'd need to pass those along when creating the lease in the k8 api somehow?
The docs for k8 mention the functionality though, so maybe I'm missing something:
https://doc.akka.io/docs/akka-management/current/kubernetes-lease.html#f-a-q
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we should look some more at this before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can merge this and investigate releasing on system termination as a separate task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, please create an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
References #31715