etcd icon indicating copy to clipboard operation
etcd copied to clipboard

etcdctl(V3):reduce session timeout for lock command

Open jiaxuanzhou opened this issue 9 years ago • 8 comments

1,the default timeout of lock command is etcd\clientv3\concurrency\session.go: defaultSessionTTL = 60 in the production scenario, when there is an unexpected server crash of the client side(container scenario: kill the docker), the client process can not capture the signal of the syscall, then the other clients must wait 60s to gain the lock, the timeout is too long in production environment, i suggest to reduce the timeout to less than 10s.

2, suggest add another mechanism to ensure the lock will be released immediately when the client process who holds the lock exited. Currently code just capture two kind of syscall signals to inform the process to close the communication link: signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)

jiaxuanzhou avatar Aug 03 '17 23:08 jiaxuanzhou

i suggest to reduce the timeout to less than 10s.

How about a --ttl flag so it's configurable?

add another mechanism to ensure the lock will be released immediately when the client process who holds the lock exited. Currently code just capture two kind of syscall signals to inform the process to close the communication link: signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)

What other mechanism?

heyitsanthony avatar Aug 04 '17 00:08 heyitsanthony

@heyitsanthony i agree with you if adding a flag to config the ttl, it can avoid the long waits when seesion expired and no other mechanism needed with a flag.

jiaxuanzhou avatar Aug 04 '17 03:08 jiaxuanzhou

@jiaxuanzhou do you want to work on this improvement?

xiang90 avatar Aug 04 '17 17:08 xiang90

@xiang90 i can work on it ,will submit a patch soon.

jiaxuanzhou avatar Aug 04 '17 23:08 jiaxuanzhou

@jiaxuanzhou thanks!

xiang90 avatar Aug 04 '17 23:08 xiang90

@xiang90 @heyitsanthony i found NewSession(client *v3.Client, opts ...SessionOption) is called by elect cmd too, need to add the flag as a gloabal role or just as a sub-flag used by lock ?

jiaxuanzhou avatar Aug 05 '17 10:08 jiaxuanzhou

@heyitsanthony related PR #8370 has been merged , the issue could be closed.

jiaxuanzhou avatar Aug 10 '17 01:08 jiaxuanzhou

ok, thanks!

heyitsanthony avatar Aug 10 '17 01:08 heyitsanthony