|
35 | 35 | -export([ |
36 | 36 | one_node_via_register_unregister/1, |
37 | 37 | one_node_via_register_unregister_with_metadata/1, |
38 | | - one_node_strict_mode/1 |
| 38 | + one_node_strict_mode/1, |
| 39 | + one_node_repeated_restart/1 |
39 | 40 | ]). |
40 | 41 | -export([ |
41 | 42 | three_nodes_discover/1, |
@@ -91,7 +92,8 @@ groups() -> |
91 | 92 | {one_node_registry, [shuffle], [ |
92 | 93 | one_node_via_register_unregister, |
93 | 94 | one_node_via_register_unregister_with_metadata, |
94 | | - one_node_strict_mode |
| 95 | + one_node_strict_mode, |
| 96 | + one_node_repeated_restart |
95 | 97 | ]}, |
96 | 98 | {three_nodes_registry, [shuffle], [ |
97 | 99 | three_nodes_discover, |
@@ -285,6 +287,21 @@ one_node_strict_mode(_Config) -> |
285 | 287 | ok = syn:register(scope, "strict-true", Self), |
286 | 288 | {Self, undefined} = syn:lookup(scope, "strict-true"). |
287 | 289 |
|
| 290 | +one_node_repeated_restart(_Config) -> |
| 291 | + %% start syn |
| 292 | + ok = syn:start(), |
| 293 | + syn:add_node_to_scopes([scope]), |
| 294 | + ViaTuple = {via, syn, {scope, <<"my proc">>, my_metadata}}, |
| 295 | + % Data races between the 'DOWN' handler and reads pre-registration reads |
| 296 | + % cause intermittent failures. Repeat count 100 is heuristically chosen as |
| 297 | + % it consistently surfaced the problem at the time of writing. |
| 298 | + RepeatCount = 100, |
| 299 | + StartStop = fun(_) -> |
| 300 | + {ok, Pid} = syn_test_gen_server:start_link(ViaTuple), |
| 301 | + gen_server:stop(Pid) |
| 302 | + end, |
| 303 | + lists:foreach(StartStop, lists:duplicate(RepeatCount, 0)). |
| 304 | + |
288 | 305 | three_nodes_discover(Config) -> |
289 | 306 | %% get slaves |
290 | 307 | SlaveNode1 = proplists:get_value(syn_slave_1, Config), |
|
0 commit comments