slackhq / nebula

A scalable overlay networking tool with a focus on performance, simplicity and security
MIT License
14.01k stars 939 forks source link

remove deadlock in GetOrHandshake #1151

Closed wadey closed 1 month ago

wadey commented 1 month ago

We had a rare deadlock in GetOrHandshake because we kept the hostmap lock when we do the call to StartHandshake. StartHandshake can block while sending to the lighthouse query worker channel, and that worker needs to be able to grab the hostmap lock to do its work. Other calls for StartHandshake don't hold the hostmap lock so we should be able to drop it here.

This lock was originally added with: https://github.com/slackhq/nebula/pull/954