Skip to content
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

Merged
merged 1 commit into from
Nov 16, 2022
Merged

Conversation

johanandren
Copy link
Member

References #31715

@@ -1181,6 +1181,7 @@ private[akka] class Shard(

override def postStop(): Unit = {
passivateIntervalTask.foreach(_.cancel())
lease.foreach(_.release())
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

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

LGTM

@patriknw patriknw merged commit 84ebc50 into main Nov 16, 2022
@patriknw patriknw deleted the wip-shard-not-releasing-lease-31715 branch November 16, 2022 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants