Add missing cluster singleton detection#7363
Merged
Aaronontheweb merged 10 commits intoakkadotnet:devfrom Nov 11, 2024
Merged
Conversation
gabor-bocso
reviewed
Oct 24, 2024
src/contrib/cluster/Akka.Cluster.Tools/Singleton/ClusterSingletonProxy.cs
Outdated
Show resolved
Hide resolved
src/contrib/cluster/Akka.Cluster.Tools/Singleton/reference.conf
Outdated
Show resolved
Hide resolved
| Success = 0, | ||
| Timeout = 1, | ||
| } | ||
| public sealed class IdentifySingletonResult : Akka.Actor.INoSerializationVerificationNeeded |
Member
There was a problem hiding this comment.
Should probably make this and the enum private so it doesn't appear in the public API surface
|
|
||
| # Interval at which the proxy will try to resolve the singleton instance. | ||
| singleton-identification-interval = 1s | ||
|
|
| /// </remarks> | ||
| /// </summary> | ||
| public sealed class ClusterSingletonProxy : ReceiveActor | ||
| public sealed class ClusterSingletonProxy : ReceiveActor, IWithTimers |
| // ignoring the timeout tick message. | ||
| if (_singleton is not null) | ||
| { | ||
| Timers.Cancel(IdentifySingletonTimeOutTick.Instance); |
Member
There was a problem hiding this comment.
I might consider adding a debug message here in case there's an actual bug that lead to this, but that's not a big deal. Good to check for this condition and just turn the timer off and return early though - LGTM
| "ClusterSingletonProxy failed to find an associated singleton named [{0}] in role [{1}] after {2} seconds.", | ||
| _settings.SingletonName, _settings.Role, _settings.SingletonIdentificationFailurePeriod.TotalSeconds); | ||
|
|
||
| Context.System.EventStream.Publish(IdentifySingletonResult.Timeout( |
Member
There was a problem hiding this comment.
Ah, is this why IdentifySingletonResult is part of the public API? So apps can subscribe to it?
Contributor
Author
There was a problem hiding this comment.
Yes, I think it is a good addition, people can use this to detect if something went wrong in their application by hooking to this event, instead of having to check their logs
This was referenced Oct 7, 2025
This was referenced Oct 7, 2025
This was referenced Nov 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As per user request, add missing cluster singleton detection to ClusterSingletonProxy to help debug misconfigured singleton setup
Detection timer:
Changes