uwiger / locks

A scalable, deadlock-resolving resource locker
Mozilla Public License 2.0
204 stars 26 forks source link

No-one becomes a leader after netsplit #25

Closed kzemek closed 8 years ago

kzemek commented 8 years ago

I found an unexpected behaviour of locks_leaders; I confirmed it using test_cb.erl. The repro is very simple:

  1. start test_cb on nodes A and B; each process is a leader
  2. connect A with B; one of test_cb processes will become the leader
  3. disconnect A and B; each process is a leader again
  4. connect A with B; both processes will be "elected" at the same time, after which both will surrender.

test_cb node A logs test_cb node B logs

uwiger commented 8 years ago

Indeed. I've pushed a fix, which also has a test for the 2-node case. I verified that it failed before, and it seems to pass with the last commit - see PR #26

kzemek commented 8 years ago

Seems to work for me. After updating to locks from the new branch I had one case where both leaders surrendered after the first connection (no netsplit in the meantime); I recompiled immediately and couldn't reproduce it after.

uwiger commented 8 years ago

Ok, I've merged the PR. Thanks for your help!