From daf1e10e0e185aecf03770b677a285a54870bd1d Mon Sep 17 00:00:00 2001 From: Vladimir Drobyshevskiy Date: Fri, 2 Oct 2026 21:40:01 +0400 Subject: [PATCH] Stop tracing the sender after the ack_sync check three_nodes_ack_sync_ordered_delivery traces 'receive' on the scope's sender process, reconnects a node, waits until the node shows up in the scope's subcluster, turns tracing off and only then looks for the traced ack_sync. The scope queues ack_sync to the sender and adds the node to nodes_map in the same handle_info call, so the node can be visible before the sender has taken the message from its queue. A message that is still queued when tracing is turned off produces no receive event, and the check fails with {badmatch,false}. Turning tracing off after the check keeps the sender traced until it receives ack_sync. The check's 2 second timeout still bounds the wait. Suspending the sender from before the reconnect until just before the check makes the test fail in 10 runs out of 10 when tracing is turned off first, and pass in 10 out of 10 with this change. Run alone 60 times on OTP 27, the case failed 5 times before the change and never after it. --- test/syn_registry_SUITE.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/syn_registry_SUITE.erl b/test/syn_registry_SUITE.erl index 63651203..d48f3252 100644 --- a/test/syn_registry_SUITE.erl +++ b/test/syn_registry_SUITE.erl @@ -1722,13 +1722,14 @@ three_nodes_ack_sync_ordered_delivery(Config) -> syn_test_suite_helper:connect_node(SlaveNode1), syn_test_suite_helper:assert_scope_subcluster(registry,node(), scope_order, [SlaveNode1]), - %% stop tracing - erlang:trace(SenderPid, false, ['receive']), - %% verify that sender_loop received a {send_single, ...} message containing ack_sync. %% this proves ack_sync is routed through sender_loop (the fix), ensuring FIFO %% ordering with sync_register/sync_unregister broadcasts. - true = check_trace_for_ack_sync_via_sender(). + true = check_trace_for_ack_sync_via_sender(), + + %% stop tracing after the check: the node can show up in the subcluster + %% before the sender has received the queued ack_sync + erlang:trace(SenderPid, false, ['receive']). three_nodes_ack_sync_reconciles_registry_snapshot(Config) -> %% ack_sync contains a full snapshot for the remote node at its FIFO point.