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

Make Leader Election timeout configurable #3263

Conversation

hayley-jean
Copy link
Member

Added: LeaderElectionTimeoutMs option to allow configuring the timeout for election messages.

Backports PR #3121 to 20.10.
Fixes https://github.com/EventStore/home/issues/605.
Adds the LeaderElectionTimeoutMs option which configures the LiveUntil and Deadlines of messages in ElectionsService

  • Deadlines when sending messages over gRPC will be based on the LiveUntil of the messages, rather than setting a deadline separately.
  • Update GossipService to use the GossipTimeout as the LiveUntil of gossip messages.

Copy link
Contributor

@thefringeninja thefringeninja left a comment

Choose a reason for hiding this comment

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

docker compose up is complaining

 System.ArgumentOutOfRangeException: leaderElectionTimeout should be greater than 1 second. (Parameter 'leaderElectionTimeout')

src/EventStore.Core/Services/ElectionsService.cs Outdated Show resolved Hide resolved
@hayley-jean hayley-jean force-pushed the hayley-jean/make-election-timeout-configurable branch from 3f1f715 to e0c302c Compare November 3, 2021 14:49
thefringeninja
thefringeninja previously approved these changes Nov 3, 2021
shaan1337
shaan1337 previously approved these changes Nov 8, 2021
Copy link
Member

@shaan1337 shaan1337 left a comment

Choose a reason for hiding this comment

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

Noticed an issue which isn't directly related to this PR:

Setting --leader-election-timeout-ms to 1 millisecond (I've commented out the >= 1 second check) then making two nodes elect a leader crashes both nodes with the following error:

[11102Unhandled exception. , 4,11:09:32.628,FTL] Global Unhandled Exception occurred.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Grpc.Net.Client.Internal.GrpcCall`2.DeadlineExceededCallback(Object state)
   at System.Threading.TimerQueueTimer.<>c.<.cctor>b__23_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)

- Adds the LeaderElectionTimeoutMs option which configures the
  LiveUntil and Deadlines of messages in ElectionsService
- Only accept the LiveUntil timespan on messages to send over gRPC. The
  LiveUntil will be used for the deadline
- Don't use the GossipInterval as a LiveUntil in the GossipService

Co-authored-by: Shaan Nobee <sniper111@gmail.com>
@hayley-jean hayley-jean force-pushed the hayley-jean/make-election-timeout-configurable branch from bb44607 to 2a69cef Compare November 8, 2021 09:33
@thefringeninja thefringeninja merged commit 2a17564 into release/oss-v20.10 Nov 8, 2021
@thefringeninja thefringeninja deleted the hayley-jean/make-election-timeout-configurable branch November 8, 2021 18:05
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

3 participants