question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timeouts seems not work in DistributedLock.Redis

See original GitHub issue

there is no -1 return after 5 seconds but after almost 30 seconds.

  await using var handle =await _lockProvider.TryAcquireLockAsync("MyLockName", TimeSpan.FromSeconds(5));
  if (handle != null)
  {    
      await Task.Delay(TimeSpan.FromSeconds(500));
      return 1;
  }
  else
  {
      return -1;
  }

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ccccccmdcommented, Nov 8, 2022

Many thanks madelson!

I get the same behavior as you describe in release mode.

It’s weird ☺.

0reactions
madelsoncommented, Nov 9, 2022

Appreciate the confirmation @ccccccmd . I’m closing this issue for now since it doesn’t appear to be specific to this library. It will be interesting to see what MSFT says.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis distributed lock does not take effect
1 Answer. The problem seems to be with the lock function. It does not check if the value existed or not, it just...
Read more >
Distributed Locks with Redis
Distributed locks are a very useful primitive in many environments where different processes must operate with shared resources in a mutually exclusive way....
Read more >
Am I missing why a distributed lock is an impossibility? ...
The short answer is because if the lock holder fails your other nodes have no way of knowing if the lock holder failed...
Read more >
6.2.5 Locks with timeouts | Redis
In order to give our lock a timeout, we'll use EXPIRE to have Redis time it out automatically. The natural place to put...
Read more >
handling redis lock timeouts #77 - sqlalchemy/dogpile.cache
So i set the lock_timeout, and that solves one problem, but creates another – if the process ends up completing after the lock_timeout,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found