Comments (6)
@rmul This has been resolved, you should be able to get the new version from https://www.nuget.org/packages/Consul/0.5.2.5 or from this repo.
from consuldotnet.
@highlyunavailable I've tested the new version, but now it seems that the sessionrenew is not run; The semaphore gets lost every sessionTTl (10 secs) and then gets re-aquired..
from consuldotnet.
@rmul I'm not seeing that behavior, actually.
I added a test method that looks like this (I grabbed some of the bits from your code, just to see if it was a weird limit or something causing it):
[TestMethod]
public void Semaphore_AcquireWaitRelease()
{
const string Name = "XService";
const string Prefix = Name + "/lock";
const int Limit = 1;
var _semaphoreOptions = new SemaphoreOptions(Prefix, Limit) { SessionName = Name + "_Session", SessionTTL = TimeSpan.FromSeconds(10) };
var c = ClientTest.MakeClient();
var s = c.Semaphore("test/semaphore", 2);
s.Acquire(CancellationToken.None);
Assert.IsTrue(s.IsHeld);
Thread.Sleep(30000);
Assert.IsTrue(s.IsHeld);
Assert.IsTrue(s.IsHeld);
s.Release();
Assert.IsFalse(s.IsHeld);
}
with the following Consul output:
2015/05/26 06:42:37 [DEBUG] http: Request /v1/session/create (2.0014ms)
2015/05/26 06:42:37 [DEBUG] http: Request /v1/kv/test/semaphore/61b1fd08-652c-b98e-2302-b70d886b9ade?flags=16210313421097356768&acquire=61b1fd08-652c-b98e-2302-b70d886b9ade (2.0011ms)
2015/05/26 06:42:37 [DEBUG] http: Request /v1/kv/test/semaphore?recurse&wait=15s (0)
2015/05/26 06:42:37 [DEBUG] http: Request /v1/kv/test/semaphore/.lock?flags=16210313421097356768&cas=10 (999.1µs)
2015/05/26 06:42:37 [DEBUG] http: Request /v1/kv/test/semaphore?recurse&consistent (0)
2015/05/26 06:42:45 [DEBUG] http: Request /v1/session/renew/61b1fd08-652c-b98e-2302-b70d886b9ade (0)
2015/05/26 06:42:52 [DEBUG] http: Request /v1/session/renew/61b1fd08-652c-b98e-2302-b70d886b9ade (0)
2015/05/26 06:43:07 [DEBUG] http: Request /v1/kv/test/semaphore/.lock (0)
2015/05/26 06:43:07 [DEBUG] http: Request /v1/kv/test/semaphore/.lock?flags=16210313421097356768&cas=19 (2ms)
2015/05/26 06:43:07 [DEBUG] http: Request /v1/kv/test/semaphore?recurse&consistent&index=19 (30.003102s)
2015/05/26 06:43:07 [DEBUG] http: Request /v1/kv/test/semaphore/61b1fd08-652c-b98e-2302-b70d886b9ade (1.0006ms)
2015/05/26 06:43:22 [DEBUG] consul.state: Session 61b1fd08-652c-b98e-2302-b70d886b9ade TTL expired
2015/05/26 06:43:22 [DEBUG] consul.state: Invalidating session 61b1fd08-652c-b98e-2302-b70d886b9ade due to session destroy
It's calling Renew twice in there, which to me says it's working.
from consuldotnet.
Ok, I'll check my code and see if I can still reproduce
from consuldotnet.
@rmul It looks like you're using an older version. I cloned a copy of your project and swapped out the consul DLL files with one from my build and it appears to be renewing sessions.
from consuldotnet.
Fixed by 65b819d - thanks @rmul
Added tests to verify this is fixed for locks as well in ef8b00d
from consuldotnet.
Related Issues (20)
- Consul.ConsulRequestException: Unexpected response, status code InternalServerError: rpc error making call: EOF HOT 4
- No way to read ServiceMeta
- ConsulConfigurationException throw if URL scheme specified in CONSUL_HTTP_ADDR environment variable. HOT 1
- Latest version is not available in Nuget HOT 2
- Add Meta dictionary to AgentService and AgentServiceRegistration HOT 1
- Does not work on netcoreapp2.1 HOT 5
- Enable HttpClientHandler pooling? HOT 2
- KV Txn call may deadlock HOT 3
- Grpc heartbeat HOT 2
- Support for Consul Connect? HOT 1
- 0.9 Port Status
- No .Net Framework 4.0 compatibility HOT 1
- Filter Service and Health by multi tags
- I hope to support the heartbeat of grpc
- Agent.ServiceRegister hangs after KV.Get with new QueryOptions {WaitIndex = index}
- Aquire Lock custom KV value
- Service status
- Bad request : Invalid wait time and multiple Get request while trying to acquire leader HOT 2
- Cluster support
- Add consul.dll.xml into the NuGet package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from consuldotnet.