Lockgate is a cross-platform distributed locking library for Go. Supports distributed locks backed by Kubernetes or HTTP lock server. Supports conventional OS file locks.
Apache License 2.0
256
stars
15
forks
source link
Fix kubernetes locker hanging when there are many 'optimistic locking' conflicts #24
The hanging was due to double locking of mutex (classic) in some situation when sending a signal to the channel. The channel is unbuffered (zero capacity), which caused blocking when sending a done-chan signal. Due to blocking on the channel send mutex remained locked. Lockgate now will release mutex first, before sending a signal to this done-chan.
Also:
Added more debug messages.
Added throttling for lease renew operation: do not perform lease renew more than once in a 3 seconds period (this was possible due to the lag/unlag in the golang-ticker).
Added sleep before retrying to change resource when optimistic locking error occured.
The hanging was due to double locking of mutex (classic) in some situation when sending a signal to the channel. The channel is unbuffered (zero capacity), which caused blocking when sending a done-chan signal. Due to blocking on the channel send mutex remained locked. Lockgate now will release mutex first, before sending a signal to this done-chan.
Also: