locks icon indicating copy to clipboard operation
locks copied to clipboard

Message lost of `locks_running` -- may cause deadlock

Open xinhaoyuan opened this issue 7 years ago • 2 comments

locks_watcher is notified by

https://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

xinhaoyuan avatar Oct 10 '18 23:10 xinhaoyuan

@xinhaoyuan sorry for the long delay, but would you like to inspect the proposed fix?

uwiger avatar Apr 02 '20 10:04 uwiger

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.

xinhaoyuan avatar Apr 06 '20 21:04 xinhaoyuan