fanliang11 / surging

Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. support Event-based Asynchronous Pattern and reactive programming ,The service engine supports http, TCP, WS,Grpc, Thrift,Mqtt, UDP, and DNS protocols. It uses ZooKeeper and Consul as a registry, and integrates it. Hash, random, polling, Fair Polling as a load balancing algorithm, built-in service governance to ensure reliable RPC communication, the engine contains Diagnostic, link tracking for protocol and middleware calls, and integration SkyWalking Distributed APM
MIT License
3.24k stars 924 forks source link

同时启动多个服务时,consul分布式锁导致异常 #363

Closed liuhll closed 5 years ago

liuhll commented 5 years ago
  1. 使用docker-compose编排服务后,同时启动多个服务时,向consul注册元数据时,大概率导致异常,异常信息如下:
    
    Consul.LockMaxAttemptsReachedException
    HResult=0x80131500
    Message=LockTryOnce is set and the lock is already held or lock delay is in effect
    Source=Consul
    StackTrace:
    在 Consul.Lock.<Acquire>d__24.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 Consul.Lock.<Acquire>d__24.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    在 Consul.ConsulClient.<AcquireLock>d__56.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 Surging.Core.Consul.ConsulServiceRouteManager.<CreateLock>d__17.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    在 Surging.Core.Consul.ConsulServiceRouteManager.<SetRoutesAsync>d__13.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    在 Surging.Core.CPlatform.Routing.Implementation.DefaultServiceRouteProvider.<RegisterRoutes>d__13.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    在 Surging.Core.CPlatform.ServiceHostBuilderExtensions.<ConfigureRoute>d__4.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    在 Surging.Core.CPlatform.ServiceHostBuilderExtensions.<>c__DisplayClass0_0.<<UseServer>b__0>d.MoveNext()
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    在 System.Threading.ThreadPoolWorkQueue.Dispatch()