syn icon indicating copy to clipboard operation
syn copied to clipboard

Verify that the process is alive in lookup/2

Open urmastalimaa opened this issue 10 months ago • 2 comments

Fixes a data-race between an ets read from lookup/2 and the ets write from the 'DOWN' handler of a registered process which causes intermittent failures in supervision strategies.

In practice, the problem can occur quite often in tests which assert the init behaviour of gen_server's. In production, the already_started errors can cause a single failure to cascade and restart the parent supervisor.

A similar approach is taken in Elixir's Registry (also backed by ets)

Fixes https://github.com/ostinelli/syn/issues/48

urmastalimaa avatar Mar 25 '25 12:03 urmastalimaa

I added a check to avoid a rpc, as the aliveness check is necessary for only local processes: https://github.com/ostinelli/syn/compare/872f137c5da0fc4978e1e6fe545b33c058ca09f6..4e1b194012e8be6b0253375c2dd9a4b4196cda41

urmastalimaa avatar Mar 25 '25 17:03 urmastalimaa

Hi!

When you have a chance, could you please re-review?

urmastalimaa avatar Jun 04 '25 08:06 urmastalimaa