Open xinhaoyuan opened 6 years ago
@xinhaoyuan sorry for the long delay, but would you like to inspect the proposed fix?
Hi @uwiger, thanks for asking. The fix looks good and should fix the bug reported.
This bug was found using Morpheus, a concurrency testing tool for Erlang. I am no longer working on the project, but I will try to run the tool on the fixed version and let you know if there are any issues.
locks_watcher
is notified byhttps://github.com/uwiger/locks/blob/8e9b2e33deec6ed375a38fc88f67eff792b91504/src/locks_server.erl#L64
However, the message could be lost if a locks_server is started after
https://github.com/uwiger/locks/blob/8e9b2e33deec6ed375a38fc88f67eff792b91504/src/locks_watcher.erl#L23
but the message is sent before the name
locks_watcher
is registered.https://github.com/uwiger/locks/blob/8e9b2e33deec6ed375a38fc88f67eff792b91504/src/locks_watcher.erl#L26