microsoft / microsoft/etcd3

Waiting two ttl-periods before declaring a lease lost seems wrong

Open
#155 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
546
Forks
76
Avg merge
22h 46m
Merged PRs (30d)
13

Description

I was reading the code to understand the lease refresh algorithm and notice this:

    // When the cluster goes down, we keep trying to reconnect. But if we're
    // far past the end of our key's TTL, there's no way we're going to be
    // able to renew it. Fire a "lost".
    if (Date.now() - this.lastKeepAlive > 2 * 1000 * this.ttl) {
      ...
    }

Waiting 2 *ttl seem problematic, the process will believe it has the lease a full ttl period after it has certainly lost it. Can this be configurable somehow? Why isn't it just 1 period?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the lease refresh algorithm and the code that compares Date.now() - this.lastKeepAlive with 2 * 1000 * this.ttl. Trace how lease loss is detected and confirm the intended TTL behavior, including whether the threshold should be configurable. Done means the lease-loss behavior is clearly defined and covered by the relevant tests, if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.